| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2003-12-05 14:20 UTC] rrichards@php.net
  | 
    |||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 08:00:01 2025 UTC | 
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