#39530 [Opn->Bgs]: __set is not called
| From: | tony2001@php.net | Date: | Thu, 16 Nov 2006 09:48:57 +0000 |
| Subject: | #39530 [Opn->Bgs]: __set is not called | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-105062@lists.php.net to get a copy of this message | ||
ID: 39530
Updated by: tony2001@php.net
Reported By: g42 at gmx dot net
-Status: Open
+Status: Bogus
Bug Type: Class/Object related
Operating System: Linux
PHP Version: 5.2.0
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Previous Comments:
------------------------------------------------------------------------
[2006-11-16 09:45:16] g42 at gmx dot net
Description:
------------
__set is not called if the property is called by reference
Reproduce code:
---------------
<?php
class Test {
private $properties;
function __construct() {
$this->properties = array();
}
function __set($name, $value) {
echo "setting $name\n";
$this->properties[$name] = $value;
}
function __get($name) {
echo "getting $name\n";
return ($this->properties[$name]);
}
}
$test = new Test;
$test->array = array("foo");
array_push($test->array, "bar");
print_r($test->array);
?>
Expected result:
----------------
setting property
getting property
setting property
getting property
Array (
[0] => foo
[1] => bar
)
Actual result:
--------------
setting property
getting property
getting property
Array (
[0] => foo
[1] => bar
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39530&edit=1