From: juergen at henge-ernst dot de
Operating system: linux
PHP version: 4.3.5RC3
PHP Bug Type: Scripting Engine problem
Bug description: double references corrupts variables
Description:
------------
I tried the following with the lastest snapshot
php4-STABLE-200403031030/sapi/cli/php
just did a ./configure without an options
when using double references (accidently or not) the variables in PHP get
corrupted.
$acl contains the content of $y
If you change the line
$y = 'TestString';
to
#$y = 'TestString';
or add an var_dump($acl) before that line
everything works as expected (including the call to the undefined function
of that object). It looks like an internal pointer is not reseted
correctly
previous version sometimes crashed wich seems no longer to be the case.
Reproduce code:
---------------
class TestObj {
var $x;
function &save() {
return $this;
}
}
$acl = new TestObj();
$acl = &$acl->save();
$y = 'TestString';
var_dump($acl);
if (is_object($acl)) {
$acl->dump();
}
Expected result:
----------------
object(testobj)(0) {
}
Actual result:
--------------
string(10) "TestString"
--
Edit bug report at http://bugs.php.net/?id=27481&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27481&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27481&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=27481&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=27481&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=27481&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=27481&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=27481&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=27481&r=support
Expected behavior: http://bugs.php.net/fix.php?id=27481&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=27481&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=27481&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=27481&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27481&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=27481&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=27481&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=27481&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27481&r=float