ID:               42289
 User updated by:  cpriest at warpmail dot net
 Reported By:      cpriest at warpmail dot net
-Status:           Bogus
+Status:           Open
 Bug Type:         SimpleXML related
 Operating System: Windows & Linux
 PHP Version:      5.2.4RC1
 New Comment:

According to the specs:
> Always returns an array of SimpleXMLElement objects.

While the xpath() is actually returning a boolean value.  Here is some
revised code which demonstrates an incorrect return value:

<?php
    require_once('inc.backend.interactive.php');
    header('Content-Type: text/plain');
    set_time_limit(0);
   
    $ResponseBody = '<?xml version="1.0"
encoding="UTF-8"?><postresponse><status
accept="no">INVALID</status></postresponse>';
   
    $objXML = new SimpleXMLElement($ResponseBody);
   
    $tMatches = $objXML->xpath('postresponse/status/@accept');
    print_r($tMatches);
    print_r(gettype($tMatches));
//    print_r((string)$tMatches[0]);
?>


Previous Comments:
------------------------------------------------------------------------

[2007-08-14 11:56:16] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

output is correct. $objXML is document element

------------------------------------------------------------------------

[2007-08-14 01:12:55] cpriest at warpmail dot net

Description:
------------
Non-absolute paths using ->xpath() do not match appropriately.  With
the  given example, changing the xpath to '/postresponse/status/@accept'
correctly returns "no"

Reproduce code:
---------------
<?
        $ResponseBody = '<?xml version="1.0"
encoding="UTF-8"?><postresponse><status
accept="no">INVALID</status></postresponse>';
        
        $objXML = new SimpleXMLElement($ResponseBody);
        
        $tMatches = $objXML->xpath('postresponse/status/@accept');
        print_r((string)$tMatches[0]);
?>

Expected result:
----------------
"no"

Actual result:
--------------
xpath() returns no results


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=42289&edit=1

Reply via email to