php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42082 NodeList length zero should be empty
Submitted: 2007-07-23 19:17 UTC Modified: 2007-08-06 16:24 UTC
From: ms419 at freezone dot co dot uk Assigned:
Status: Closed Package: DOM XML related
PHP Version: 5.2.3 OS: Debian unstable
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ms419 at freezone dot co dot uk
New email:
PHP Version: OS:

 

 [2007-07-23 19:17 UTC] ms419 at freezone dot co dot uk
Description:
------------
When NodeList length is int(0), empty($nodes->length) should be true

Reproduce code:
---------------
<?php

$doc = new DOMDocument();
$xpath = new DOMXPath($doc);
$nodes = $xpath->query('*');
var_dump($nodes);
var_dump($nodes->length);
var_dump(empty($nodes->length));


Expected result:
----------------
ket% php tmp.php
object(DOMNodeList)#3 (0) {
}
int(0)
bool(true)
ket% 

Actual result:
--------------
ket% php tmp.php
object(DOMNodeList)#3 (0) {
}
int(0)
bool(false)
ket% 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-06 16:24 UTC] rrichards@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 08:01:29 2024 UTC