php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28916 Reference result of XPath becomes empty.
Submitted: 2004-06-25 11:28 UTC Modified: 2004-06-28 07:33 UTC
From: s dot masugata at digicom dot dnp dot co dot jp Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 4.3.7 OS: RedHat9 Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: s dot masugata at digicom dot dnp dot co dot jp
New email:
PHP Version: OS:

 

 [2004-06-25 11:28 UTC] s dot masugata at digicom dot dnp dot co dot jp
Description:
------------
Reference result becomes empty when an XML file is searched.

<?xml version="1.0" ?>
<country>
  <list no="1">
    <name>Japan</name>
    <language>Japanese</language>
    <area>Asia</area>
  </list>
</country>

Reference result becomes empty when an XML file is searched.
However, reference result comes by PHP4.3.3 on the contrary.

PHP-4.3.3[cli]
PHP-4.3.7[cli]
libxml2-2.6.10


Reproduce code:
---------------
<?
$XML = domxml_open_file( "country.xml" );

foreach( $XML->get_elements_by_tagname( "/country/list[@no=1]" ) as $Array )
{
  foreach( $Array->child_nodes( ) as $Child_Array )
  {
    $TagName         = $Child_Array->node_name( );
    $Value[$TagName] = de_convert( $Child_Array->get_content( ) );
 }

 echo "------------------------\n".
      "Country :".$Value["name"]."\n".
      "Area    ?F".$Value["area"]."\n".
      "Language?F".$Value["language"]."\n\n";
}
?>


Expected result:
----------------
------------------------
Country :Japan
Area    :Asia
Language:Japanese

Actual result:
--------------
empty.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-06-28 07:33 UTC] chregu@php.net
get_elements_by_tagname can't be used for xpath searches anymore. This was a bug in 4.3.3. Please use the appropriate XPath functions, for example xpath_eval (http://www.php.net/manual/en/function.xpath-eval.php)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 14:01:36 2025 UTC