php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18119 domxml extension: DomDocument->create_element() doesn't work
Submitted: 2002-07-02 18:11 UTC Modified: 2002-11-02 01:00 UTC
Votes:20
Avg. Score:4.8 ± 0.5
Reproduced:18 of 19 (94.7%)
Same Version:2 (11.1%)
Same OS:6 (33.3%)
From: mk at lrn dot ru Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 4.0CVS-2002-07-02 OS: ALTLinux-2.4.18, glibc 2.2.5
Private report: No CVE-ID: None
 [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();
?>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-17 22:01 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip


 [2002-10-20 21:42 UTC] emile at huasing dot com
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.
 [2002-11-02 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over 2 weeks, 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".
 [2005-10-08 02:46 UTC] saltymeat at hotmail dot com
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."
 [2007-02-17 17:58 UTC] rzur at poczta dot onet dot pl
I have the same problem on Apache 2.0.59 with PHP 5.2.1 on Widnows XP 32 bit.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 12 18:01:26 2024 UTC