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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2021 The PHP Group
All rights reserved.
Last updated: Sun Jan 24 10:01:24 2021 UTC