php.net |  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
Votes:4
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
 [2009-12-08 03:14 UTC] 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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-19 08:26 UTC] mike@php.net
SimpleXML is already the magicians nipple, and needs to handle get/set property operations itself.
 [2010-05-19 08:26 UTC] mike@php.net
-Status: Verified +Status: Wont fix
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 10 01:01:26 2024 UTC