|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38885 Method DOMElement->hasAttribute() (sometimes) does not work
Submitted: 2006-09-19 16:46 UTC Modified: 2006-09-27 01:00 UTC
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: lhaire at lettres dot unige dot ch Assigned:
Status: No Feedback Package: DOM XML related
PHP Version: 5.1.6 OS: Mandriva Linux/PREFORK-13.3.2006
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.
Block user comment
Status: Assign to:
Bug Type:
From: lhaire at lettres dot unige dot ch
New email:
PHP Version: OS:


 [2006-09-19 16:46 UTC] lhaire at lettres dot unige dot ch
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'))

Expected result:
This code works:

 $j =0;
			while (($j < $nhum) && ($human->item($j)->getAttribute('expert') != 'yes'))

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:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-19 16:55 UTC]
Please try using this CVS snapshot:
For Windows:
 [2006-09-27 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 23 12:01:30 2024 UTC