|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-09-02 09:56 UTC] 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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 07 12:00:01 2025 UTC |
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).