php.net |  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
Votes:1
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
 [2006-09-19 16:46 UTC] 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:
--------------
 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-19 16:55 UTC] derick@php.net
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
 [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: Sat Dec 21 12:01:31 2024 UTC