From:
Operating system:
PHP version: Irrelevant
Package: SimpleXML related
Bug Type: Bug
Bug description:Getting a SimpleXMLElement tree with differents objects as nodes
Description:
------------
Now, it is not possible to get different objects that inherit from
SimpleXMLElement as nodes of the SimpleXML tree. We get a warning with the
message "It is not yet possible to assign complex types to properties", but
it is not a complex types: it is a child of SimpleXMLElement. Maybe, we can
avoid the warning of assigning unknown object if this object inherits from
SimpleXMLElement? It could save a lot of time for interpreting a SimpleXML
tree.
Test script:
---------------
<?php
$xml = '<?xml version="1.0" encoding="utf-8"?>' . "\n" .
'<handler>' . "\n" .
' <foo>' . "\n" .
' <bar>baz</bar>' . "\n" .
' </foo>' . "\n" .
' <foo>' . "\n" .
' <bar>qux</bar>' . "\n" .
' </foo>' . "\n" .
'</handler>';
class A extends SimpleXMLElement { }
class B extends SimpleXMLElement { }
$sxe = simplexml_load_string($xml, 'A');
$sxe->foo[0] = simplexml_import_dom(
dom_import_simplexml($sxe->foo[0]),
'B'
);
print_r($sxe);
Expected result:
----------------
A Object
(
[foo] => Array
(
[0] => ___B___ Object
(
[bar] => baz
)
[1] => A Object
(
[bar] => qux
)
)
)
Actual result:
--------------
Warning: It is not yet possible to assign complex types to properties in
... on line 18
A Object
(
[foo] => Array
(
[0] => A Object
(
[bar] => baz
)
[1] => A Object
(
[bar] => qux
)
)
)
--
Edit bug report at http://bugs.php.net/bug.php?id=52889&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=52889&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=52889&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=52889&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=52889&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=52889&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=52889&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=52889&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=52889&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=52889&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=52889&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=52889&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=52889&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=52889&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=52889&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52889&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52889&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=52889&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=52889&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=52889&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=52889&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=52889&r=mysqlcfg