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
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: babooka at hotmail dot com
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2020 The PHP Group
All rights reserved.
Last updated: Tue Oct 27 12:01:22 2020 UTC