#25831 [NEW]: Pass by reference doesn't work with subclasses of DB_DataObject

From: Date: Fri, 10 Oct 2003 23:30:28 +0000
Subject: #25831 [NEW]: Pass by reference doesn't work with subclasses of DB_DataObject
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-22579@lists.php.net to get a copy of this message
From: viking at dslnorthwest dot net Operating system: Mac OS X 10.2.8 PHP version: 4.3.3 PHP Bug Type: PEAR related Bug description: Pass by reference doesn't work with subclasses of DB_DataObject Description: ------------ When extending the DB_DataObject class using PHP 4.3.3, pass-by-reference calls to class methods don't work. After removing the call to overload() at the bottom of DB_DataObject.php, references work as expected. The following comments at the bottom of DB_DataObject allude to this: // technially 4.3.2RC1 was broken!! // looks like 4.3.3 may have problems too.... if ((phpversion() != '4.3.2-RC1') && (version_compare( phpversion(), "4.3.1") > 0)) { overload('DB_DataObject'); $GLOBALS['_DB_DATAOBJECT']['OVERLOADED'] = true; } Reproduce code: --------------- require_once("DB/DataObject.php"); class no_problem { function pass_by_reference(&$ref) { $ref = "Pass by reference works"; } } class problem extends DB_DataObject { function pass_by_reference(&$ref) { $ref = "Pass by reference works"; } } $good = &new no_problem(); $bad = &new problem(); $message = "Pass by reference does not work!"; $good->pass_by_reference($message); print "$message\n"; $message = "Pass by reference does not work!"; $bad->pass_by_reference($message); print "$message\n"; Expected result: ---------------- Pass by reference works Pass by reference works Actual result: -------------- Pass by reference works Pass by reference does not work! -- Edit bug report at http://bugs.php.net/?id=25831&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25831&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25831&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=25831&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=25831&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=25831&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=25831&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=25831&r=support Expected behavior: http://bugs.php.net/fix.php?id=25831&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=25831&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=25831&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=25831&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25831&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=25831&r=dst IIS Stability: http://bugs.php.net/fix.php?id=25831&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=25831&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=25831&r=float

« previous php.pear.dev (#22579) next »