#50405 [Opn->Ver]: SimpleXML __get and __set are not invoked
ID: 50405
Updated by: jani@php.net
Reported By: babooka at hotmail dot com
-Status: Open
+Status: Verified
Bug Type: SimpleXML related
-Operating System: Linux
+Operating System: *
-PHP Version: 5.2.11
+PHP Version: 5.*, 6
Previous Comments:
------------------------------------------------------------------------
[2009-12-08 03:14:55] babooka at hotmail dot com
Description:
------------
Related to:
http://bonsai.php.net/bug.php?id=45971
SimpleXML magic __get / __set elements are not called, as a result
you can not extend the XML parsing and in addition to that
SoapClient's
classmap becomes useless, they are not called there either.
Reproduce code:
---------------
<?php
class TestSimpleXMLElement extends SimpleXMLElement {
function __set($name, $value) { echo "__set $name\n"; }
function __get($name) { echo "__get $name\n"; }
function __call($name, $parameters) { echo "__call $name\n"; }
}
$element = new TestSimpleXMLElement('<root/>');
// __set
$element->child1 = 1;
// __get
$element->child2;
// __call
$element->method();
Expected result:
----------------
__set child1
__get child2
__call method
Actual result:
--------------
__call method
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50405&edit=1
Thread (4 messages)