|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45971 SimpleXMLElement does not overload properly
Submitted: 2008-09-02 09:56 UTC Modified: 2009-02-20 01:00 UTC
Avg. Score:4.7 ± 0.5
Reproduced:6 of 6 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: dennis at d23 dot nl Assigned:
Status: No Feedback Package: SimpleXML related
PHP Version: 5.2.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: dennis at d23 dot nl
New email:
PHP Version: OS:


 [2008-09-02 09:56 UTC] dennis at d23 dot nl
When extending SimpleXMLElement the __get() and __set() methods of the extending class do not get invoked. 
__call however works as expected.

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
 [2009-02-13 00:15 UTC]
Please try using this CVS snapshot:
For Windows:

 [2009-02-20 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2010-09-06 14:39 UTC] andreas at softwaredesign dot se
Still get the exact same results. 

My PHP version is:
PHP 5.3.2-1ubuntu4.2 with Suhosin-Patch (cli) (built: May 13 2010 20:03:45) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    with Xdebug v2.0.5, Copyright (c) 2002-2008, by Derick Rethans

(The default version in ubuntu 10.04 repositories).
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 21 13:01:27 2024 UTC