#38885 [Opn->Fbk]: Method DOMElement->hasAttribute() (sometimes) does not work
| From: | derick@php.net | Date: | Tue, 19 Sep 2006 16:55:50 +0000 |
| Subject: | #38885 [Opn->Fbk]: Method DOMElement->hasAttribute() (sometimes) does not work | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-102457@lists.php.net to get a copy of this message | ||
ID: 38885
Updated by: derick@php.net
Reported By: lhaire at lettres dot unige dot ch
-Status: Open
+Status: Feedback
Bug Type: DOM XML related
Operating System: Mandriva Linux/PREFORK-13.3.2006
PHP Version: 5.1.6
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.2-win32-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2006-09-19 16:46:11] lhaire at lettres dot unige dot ch
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 this bug report at http://bugs.php.net/?id=38885&edit=1