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
 [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

Pull Requests

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: Mon Dec 30 14:01:28 2024 UTC