#38885 [NEW]: Method DOMElement->hasAttribute() (sometimes) does not work
| From: | lhaire at lettres dot unige dot ch | Date: | Tue, 19 Sep 2006 16:46:11 +0000 |
| Subject: | #38885 [NEW]: Method DOMElement->hasAttribute() (sometimes) does not work | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-102435@lists.php.net to get a copy of this message | ||
From: lhaire at lettres dot unige dot ch
Operating system: Mandriva Linux/PREFORK-13.3.2006
PHP version: 5.1.6
PHP Bug Type: DOM XML related
Bug description: Method DOMElement->hasAttribute() (sometimes) does not work
Description:
------------
The above method returns false when it was supposed to be true... PHP
version: 5.0.4 (the latest in my Mandrake distribution)
Reproduce code:
---------------
$human = $item->getElementsByTagName('HUMAN_CORR');
$nhum = $human->length;
if ($nhum >0){
$j =0;
while (($j < $nhum) &&(!$human->item($j)->hasAttribute('expert'))
$j++;
Expected result:
----------------
This code works:
$j =0;
while (($j < $nhum) && ($human->item($j)->getAttribute('expert') !=
'yes'))
$j++;
here is a short xml sample:
<HUMAN_CORR index="h1" itemTag="i00018"
correctchoice="yes">confortable</HUMAN_CORR>
<HUMAN_CORR index="he_5" itemTag="i00018" expert="yes"
correctchoice="yes">à l'aise</HUMAN_CORR>
Actual result:
--------------
--
Edit bug report at http://bugs.php.net/?id=38885&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38885&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38885&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38885&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38885&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=38885&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=38885&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=38885&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=38885&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=38885&r=support
Expected behavior: http://bugs.php.net/fix.php?id=38885&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=38885&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=38885&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38885&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38885&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38885&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=38885&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=38885&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=38885&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=38885&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=38885&r=mysqlcfg