.. and other mailing list answers.
This page is meant to be a quick and easy scratchpad of good answers and ideas - candidates to be polished and migrated into the proper FAQs.
Ryan: My name is Ryan, and I am the developer of CloudFusion[1] — a PHP SDK for working with Amazon Web Services[2]. I'm getting ready to push a new major release, and I've been exploring my options with regard to deploying via a PEAR channel.
I'm keenly interested in avoiding the infrastructure requirements (however minor) of running my own PEAR channel, so I wanted to find out what my options were for getting my package added to the default PEAR channel (despite the fact that CloudFusion is not an official PEAR package). If this sort of thing is discouraged, are there third-party PEAR channels that (a) would be likely to host my package, and (b) have a reliable service/uptime?
Any help or direction would be appreciated. Thanks! :)
cweiske: PEAR itself won't host your package, but you can try pearhub and pearfarm.
doconnor: http://www.pirum-project.org/ = insanely easy to do if you've got a scrap of web space anywhere.
http://saltybeagle.com/2008/12/using-simplechannelserver-to-manage-a-pear-channel-on-google-code/ = pretty easy to do and ends up letting you host on google code
Fixing a unit test / E_DEPRECATED problem: Let's take for example, Net_DNS - http://pear.php.net/package/Net_DNS/
# Check the open bugs to see if there is one already # http://pear.php.net/package/Net_DNS/ # Grab the code from svn: $ svn co http://svn.php.net/pear/repository/packages/Net_DNS/trunk Net_DNS # Next, run the unit tests to make sure it all works on your environment: $ cd Net_DNS $ php tests/AllTests.php # If the tests don't run, you may need to install phpunit or other dependencies $ pear channel-discover pear.phpunit.de $ pear install phpunit/phpunit $ php tests/AllTests.php
Hopefully, they all pass!
So, there are things to fix with ereg.
WARNING: Function 'ereg' is deprecated, please use 'preg_match' instead in file ./Net_DNS/Net/DNS/RR/TXT.php line 62 WARNING: Function 'ereg' is deprecated, please use 'preg_match' instead in file ./Net_DNS/Net/DNS/RR/SRV.php line 67 WARNING: Function 'ereg' is deprecated, please use 'preg_match' instead in file ./Net_DNS/Net/DNS/RR/MX.php line 61 WARNING: Function 'ereg' is deprecated, please use 'preg_match' instead in file ./Net_DNS/Net/DNS/RR/NAPTR.php line 79 WARNING: Function 'ereg' is deprecated, please use 'preg_match' instead in file ./Net_DNS/Net/DNS/RR/SOA.php line 77
The first - the constructor of Net_DNS_RR_TXT has:
ereg('("[^"]*"|[^ \t]*)[ \t]*$', $data, $regs);
It's probably best to start with a unit test that shows the error up:
function Net_DNS_RR_TXT(&$rro, $data, $offset = '') { ... snip ... if ($offset) { .... snip ... } elseif (is_array($data)) { .... snip ... } else { $data = str_replace('\\\\', chr(1) . chr(1), $data); /* disguise escaped backslash */ $data = str_replace('\\"', chr(2) . chr(2), $data); /* disguise \" */ ereg('("[^"]*"|[^ \t]*)[ \t]*$', $data, $regs); $regs[1] = str_replace(chr(2) . chr(2), '\\"', $regs[1]); $regs[1] = str_replace(chr(1) . chr(1), '\\\\', $regs[1]); $regs[1] = stripslashes($regs[1]); $this->text = $regs[1]; }
Would be something like:
class Net_DNS_RR_TXTTest extends PHPUnit_Framework_TestCase { public function testShouldConstruct() { $foo = new Net_DNS_RR_TXT(null, "fakedatainhere"); $this->assertSame("something", $foo->text); } }
Run it to check it fails:
$ php tests/AllTests.php
So; to make the actual change: http://au.php.net/ereg is probably best replaced with preg_match() - however, you might need to convert the regex too.
Make the change, run the tests, and hey presto everything should pass.
Make yourself a universal diff:
$ svn diff > myPatch.txt
... and upload it to a bug report / pastebin.
Login with your SVN credentials.