#27481 [Ver->Csd]: double references corrupts variables
ID: 27481
Updated by: andi@php.net
Reported By: juergen at henge-ernst dot de
-Status: Verified
+Status: Closed
Bug Type: Scripting Engine problem
Operating System: linux
PHP Version: 4.3.5RC3
Assigned To: andi
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2004-03-03 08:22:47] derick@php.net
Verified, but works in PHP 5.0dev (and beta4).
------------------------------------------------------------------------
[2004-03-03 08:16:05] juergen at henge-ernst dot de
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 this bug report at http://bugs.php.net/?id=27481&edit=1
Thread (3 messages)