From: asnyder at mddev dot com
Operating system: Linux Fedora Core 4
PHP version: 5.2.3
PHP Bug Type: Scripting Engine problem
Bug description: Indirect Modification Notice due to modification using __set
Description:
------------
Ok, the bug is as follows. If one gets an array, via the __get, and then
continues to modify the subobject properties using a __set. It will call
the __set function, but throw the
Notice: Indirect modification of overloaded property A::$Test has no
effect in /var/www/html/Tests/PHPBug.php on line 43
In PHP 5.1.2 this process worked fine, but in 5.2.3 it causes the notice.
Reproduce code:
---------------
class A
{
private $Test = array("One" => null, 'Two' => null);
function A()
{
$this->Test['One'] = new B();
}
function __get($val)
{
return $this->Test;
}
}
class B
{
private $SomeVariable;
function GetSomething(){return $this->SomeVariable;}
function SetSomething($bool)
{
$this->SomeVariable = $bool;
}
function __get($val)
{
$this->GetSomething();
}
function __set($part, $val)
{
$this->SetSomething($val);
}
}
$tmpA = new A();
// Now in PHP 5.1.2 the following code works, in PHP 5.2.3 but throws the
notice Indirect modification of overloaded property
$tmpA->Test['One']->Something = true;
//In PHP 5.2.3 one would have to do the following for the notice not to
throw. Which is not the expected behavior
//$tmpA->Test['One']->SetSomething(true);
Expected result:
----------------
The SetSomething($val) function should be called, and it IS being called,
but with throwing a notice. It should behave like in 5.1.2 and run the
SetSomething($val) function without the notice.
One should NOT have to call $tmpA->Test['One']->SetSomething(true) to not
raise the notice.
Actual result:
--------------
Calls function and throws notice.
--
Edit bug report at http://bugs.php.net/?id=41641&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=41641&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=41641&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=41641&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=41641&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=41641&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=41641&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=41641&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=41641&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=41641&r=support
Expected behavior: http://bugs.php.net/fix.php?id=41641&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=41641&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=41641&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=41641&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41641&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=41641&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=41641&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=41641&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=41641&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=41641&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=41641&r=mysqlcfg