#26531 [Opn->Csd]: get_elements_by_tag_name() wildcard fails
| From: | rrichards@php.net | Date: | Fri, 05 Dec 2003 19:20:08 +0000 |
| Subject: | #26531 [Opn->Csd]: get_elements_by_tag_name() wildcard fails | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-51730@lists.php.net to get a copy of this message | ||
ID: 26531
Updated by: rrichards@php.net
Reported By: jon at hiveminds dot net
-Status: Open
+Status: Closed
Bug Type: DOM XML related
Operating System: Windows 2000 / SP4
PHP Version: 4.3.4
New Comment:
This bug has been fixed in CVS.
In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2003-12-05 06:38:59] jon at hiveminds dot net
Description:
------------
The use of a wildcard with the get_elements_by_tagname() method to
obtain a collection of all DomElement nodes in a document appears to be
broken in PHP4.3.4 for Windows. Rather than returning an array, it
returns NULL. Upgrading broke numerous scripts depending on this
behaviour, which reverted to normal as soon as I rolled back to 4.3.3.
The use of "*" as a wildcard in this fashion is per the W3C DOM spec,
and performed as expected in PHP4.3.0-4.3.3 / win32.
Extensions enabled: cpdf, ctype, curl, domxml, gd2, iconv, ming, pdf,
pgsql, xslt, yaz, zip
Versions of libxml, libxslt, and iconv used were those supplied in the
distributions downloaded from php.net.
Server: IIS/5.0
The only other apps installed on this system are: MySQL 4.1-alpha,
ActivePython-2.2.2-224, ActivePerl-5.8.1.807, MSIE 5.0, MSXML 4.0
Reproduce code:
---------------
<?php
// Used 2 small XML files which are known
// to be well-formed; domxml_open_file() succeeds
// in both cases
if( !$map = domxml_open_file( realpath("xml/map.xml") ) )
return;
$alltags = $map->get_elements_by_tagname("*");
echo count($alltags) . "<br>";
echo (is_array($alltags) ? "ARRAY" : "NOT ARRAY") . "<br>";
echo $alltags === NULL ? "NULL" : "NOT NULL";
?>
Expected result:
----------------
Script output under PHP 4.3.3:
138
ARRAY
NOT NULL
69
ARRAY
NOT NULL
The XML files used contain 138 and 69 tags each (counting the document
root), so these are correct. Both files were generated using DOMXML
DomDocument->dump_file(real_path("path/to/file.xml"), FALSE, FALSE).
Actual result:
--------------
Same script and XML files under PHP 4.3.4:
0
NOT ARRAY
NULL
0
NOT ARRAY
NULL
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26531&edit=1