|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-07-02 18:11 UTC] mk at lrn dot ru
It seems, that ZendEngine2 breaks create_element() behavior. This method returns NULL instead of DomElement object.
There is my test code.
<?php
$doc = domxml_new_doc("1.0");
$root = $doc->create_element("xdocument");
$root = $doc->append_child($root);
$descr = $doc->create_element("description");
$descr = $root->append_child($descr);
print $doc->dump_mem();
?>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 10:00:02 2025 UTC |
I got the same problem also. I'm using ZendEngine2 (PHP4.3.0_zend2_alpha3). Following are my two test cases. 1. $elm = new DomElement("element"); It returns an DomElement object with NO property. I traced the source code, found that the internal constructor function domxml_doc_create_element() was not invoked. 2. $elm = $doc->create_element("element"); The method returns NULL. Furthermore, the internal function domxml_doc_create_element() applied on the wrong object $doc instead of $elm ($doc's type changed to XML_ELEMENT_NODE, previously it was XML_DOCUMENT_NODE ). Dump of $doc is like this: domdocument Object ( [name] => #document [url] => [version] => 1.0 [standalone] => -1 [type] => 1 [compression] => -1 [charset] => 1 [0] => 2 [1] => 136550520 [tagname] => element ) Above bugs exist in all Dom* classes and create_* methods. After I compiled php4 with zend1.3.0, above test cases passed, everything became OK. So I believe it is some kind of bug within ZendEnging2.This problem exists under my setup of PHP 5.0.5, its associated php_domxml.dll module for the same version of PHP, and Windows XP Professional served under Apache 2.0.54. create_element() as well as create_element_ns() return NULL, without so much as a notice. In fact, I have never been able to get it to return anything but NULL. Another example, even simpler, that reproduces the error: <?php $doc = domxml_new_doc("1.0"); $root = $doc->create_element("notifications"); echo "<pre>"; var_dump($root); echo "</pre>"; ?> The output is "NULL."