#33906 [NEW]: value comparsion doesn't work as expected
| From: | ray-chords at gmx dot net | Date: | Thu, 28 Jul 2005 14:07:04 +0000 |
| Subject: | #33906 [NEW]: value comparsion doesn't work as expected | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-82594@lists.php.net to get a copy of this message | ||
From: ray-chords at gmx dot net
Operating system: Debian Sarge
PHP version: 5.0.4
PHP Bug Type: SimpleXML related
Bug description: value comparsion doesn't work as expected
Description:
------------
Intention was to compare a string value with an xml node value. But direct
access to the value fails.
Reproduce code:
---------------
<?php
$xml_string = <<<EOD
<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<document>
<command default="yes"><id><![CDATA[li]]></id></command>
<command><id><![CDATA[reg]]></id></command>
<command><id><![CDATA[cq]]></id></command>
<command><id><![CDATA[tipp]]></id></command>
<command><id><![CDATA[pwd]]></id></command>
</document>
EOD;
$xml = simplexml_load_string($xml_string);
$template = $xml->xpath('/document/command/id');
foreach ($template as $v) {
$out = ($v->id == 'pwd') ? 'OK' : 'FALSE';
print $out . "\n";
}
?>
Expected result:
----------------
I'd expected an 'OK' in the last loop. But I always get 'FALSE'.
--
Edit bug report at http://bugs.php.net/?id=33906&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33906&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33906&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33906&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33906&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33906&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33906&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33906&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33906&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33906&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33906&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=33906&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=33906&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33906&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33906&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33906&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33906&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33906&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33906&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33906&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33906&r=mysqlcfg