Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.8.1

Bug #10783 Net_IDNA::getInstance() reference notice
Submitted: 2007-04-20 03:31 UTC
From: aharvey Assigned: neufeind
Status: Closed Package: Net_IDNA (version 0.7.1)
PHP Version: 5.2.1 OS: Irrelevant
Roadmaps: (Not assigned)    
Subscription  


 [2007-04-20 03:31 UTC] aharvey (Adam Harvey)
Description: ------------ Net_IDNA causes an E_NOTICE because of the way it returns a reference to the class instance. The attached patch (against 0.7.1, since the CVS is non-responsive) fixes this. Test script: --------------- <?php include 'Net/IDNA.php'; $idna = &Net_IDNA::getInstance(); ?> Expected result: ---------------- No output. Actual result: -------------- Notice: Only variable references should be returned by reference in /usr/share/pear/Net/IDNA.php on line 65 Call Stack: 0.0003 1. {main}() /tmp/test.php:0 0.0010 2. Net_IDNA::getInstance() /tmp/test.php:3

Comments

 [2008-03-22 13:31 UTC] neufeind (Stefan Neufeind)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.
 [2009-07-23 21:23 UTC] gauthierm (Michael Gauthier)
The attached patch will still cause a notice in the case that false is returned and is less efficient for PHP4 (I presume that's the entire reason a reference is returned). I have a revised patch that addresses these two problems. This maintains PHP4 compatibility and efficiency while preventing notices in PHP5.