#45971 [Opn->Fbk]: SimpleXMLElement does not overload properly
ID: 45971
Updated by: jani@php.net
Reported By: dennis at d23 dot nl
-Status: Open
+Status: Feedback
Bug Type: SimpleXML related
Operating System: *
PHP Version: 5.2.6
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
Previous Comments:
------------------------------------------------------------------------
[2008-09-02 09:56:51] dennis at d23 dot nl
Description:
------------
When extending SimpleXMLElement the __get() and __set() methods of the
extending class do not get invoked.
__call however works as expected.
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=45971&edit=1
Thread (4 messages)