|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50405 SimpleXML __get and __set are not invoked
Submitted: 2009-12-08 03:14 UTC Modified: 2010-05-19 08:26 UTC
Avg. Score:4.5 ± 0.9
Reproduced:4 of 4 (100.0%)
Same Version:2 (50.0%)
Same OS:0 (0.0%)
From: babooka at hotmail dot com Assigned:
Status: Wont fix Package: SimpleXML related
PHP Version: 5.*, 6 OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: babooka at hotmail dot com
New email:
PHP Version: OS:


 [2009-12-08 03:14 UTC] babooka at hotmail dot com
Related to:

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:

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
// __call

Expected result:
__set child1
__get child2
__call method

Actual result:
__call method


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-19 08:26 UTC]
SimpleXML is already the magicians nipple, and needs to handle get/set property operations itself.
 [2010-05-19 08:26 UTC]
-Status: Verified +Status: Wont fix
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue Jun 06 13:03:38 2023 UTC