#32334 [Fbk->NoF]: __set acts unexpected with variable variables
| From: | sniper@php.net | Date: | Fri, 25 Mar 2005 00:53:12 +0000 |
| Subject: | #32334 [Fbk->NoF]: __set acts unexpected with variable variables | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-77093@lists.php.net to get a copy of this message | ||
ID: 32334
Updated by: sniper@php.net
Reported By: mk at peytz dot dk
-Status: Feedback
+Status: No Feedback
Bug Type: Zend Engine 2 problem
Operating System: Linux
PHP Version: 5CVS-200503190530
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2005-03-19 12:38:36] tony2001@php.net
Can't reproduce *your* behaviour with latest 5.0.x & 5.1 CVS.
But some issue really exists, as I get NULL instead of 'b' with both
branches.
------------------------------------------------------------------------
[2005-03-19 07:44:07] mk at peytz dot dk
But the problem persist with the CVS snapshot (which now compiles
again).
------------------------------------------------------------------------
[2005-03-18 19:23:13] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
------------------------------------------------------------------------
[2005-03-16 13:29:45] mk at peytz dot dk
Description:
------------
When setting variable variable values on a instance of a class with an
overloading __set function changing another instance variable goes
wrong.
(I'm reporting it for version 5.0.3 because the current cvs snapshot
would not compile.)
Reproduce code:
---------------
http://dev.peytz.dk/~mk/setter.php
<?php
class Setter
{
private $_fields = array(); // the data fields
private $_changedFields = array(); // list of changed fields
function __set($name, $value)
{
// set value
$this->_fields[$name] = $value;
// add to list of changed fields
$this->_changedFields[] = $name;
}
}
$foo = new Setter;
$foo->a = 1;
$var = "b";
$foo->$var = 2;
var_export($foo);
?>
Expected result:
----------------
class Setter {
private $_fields =
array (
'a' => 1,
'b' => 2,
);
private $_changedFields =
array (
0 => 'a',
1 => 'b',
);
}
Actual result:
--------------
class Setter {
private $_fields =
array (
'a' => 1,
'b' => 2,
);
private $_changedFields =
array (
0 => 'a',
1 => '',
);
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32334&edit=1