|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull Requests |
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 15:00:02 2025 UTC |
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 ) ) )