Req #60577 [Opn->Ver]: count(new EmptyIterator) returns 1

From: Date: Thu, 12 Sep 2013 20:33:14 +0000
Subject: Req #60577 [Opn->Ver]: count(new EmptyIterator) returns 1
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-181557@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=60577&edit=1

 ID:                 60577
 Updated by:         levim@php.net
 Reported by:        adam at sixohthree dot com
 Summary:            count(new EmptyIterator) returns 1
-Status:             Open
+Status:             Verified
 Type:               Feature/Change Request
 Package:            SPL related
 PHP Version:        5.4SVN-2011-12-20 (SVN)
 Block user comment: N
 Private report:     N

 New Comment:

I confirmed this for versions 5.1.0 - 5.5.3.


Previous Comments:
------------------------------------------------------------------------
[2011-12-20 20:17:50] adam at sixohthree dot com

Description:
------------
As an object that simulates a list of zero items, count(new EmptyIterator) should 
return zero.

Test script:
---------------
<?php
$it = new EmptyIterator;
var_dump(count($it));

Expected result:
----------------
int(0)

Actual result:
--------------
int(1)


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=60577&edit=1


Thread (8 messages)

« previous php.bugs (#181557) next »