Bug #67064 [NEW]: Countable interface prevents using 2nd parameter ($mode) of count() function
From: trainmaster at gmx dot net
Operating system: Windows 7 64 bit
PHP version: Irrelevant
Package: SPL related
Bug Type: Bug
Bug description:Countable interface prevents using 2nd parameter ($mode) of count() function
Description:
------------
Implementing the countable interface does not allow to use the $mode
parameter of the count() function.
I think it can be easily fixed without BC.
Test script:
---------------
class Counter implements Countable
{
public function count()
{
var_dump(func_get_arg(0));
return count($this->data);
}
}
$counter = new Counter;
count($counter, COUNT_RECURSIVE);
Expected result:
----------------
// int(1)
Actual result:
--------------
// Warning: func_get_arg(): Argument 0 not passed to function
--
Edit bug report at https://bugs.php.net/bug.php?id=67064&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=67064&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=67064&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=67064&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=67064&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=67064&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=67064&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=67064&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=67064&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=67064&r=support
Expected behavior: https://bugs.php.net/fix.php?id=67064&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=67064&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=67064&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=67064&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=67064&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=67064&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=67064&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=67064&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=67064&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=67064&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=67064&r=mysqlcfg
Thread (11 messages)
- trainmaster at gmx dot net
- bwoebi@php.netBug #67064 [Opn->Asn]: Countable interface prevents using 2nd parameter ($mode) of count() function
- bwoebi@php.netBug #67064 [Asn->Csd]: Countable interface prevents using 2nd parameter ($mode) of count() function
- mbeccati@php.netBug #67064 [PATCH]: Countable interface prevents using 2nd parameter ($mode) of count() function
- mbeccati@php.netBug #67064 [Csd]: Countable interface prevents using 2nd parameter ($mode) of count() function
- bwoebi@php.netBug #67064 [Csd]: Countable interface prevents using 2nd parameter ($mode) of count() function
- tyrael@php.netBug #67064 [Csd->ReO]: Countable interface prevents using 2nd parameter ($mode) of count() function
- ab@php.netBug #67064 [ReO->Csd]: Countable interface prevents using 2nd parameter ($mode) of count() function
- bwoebi@php.netBug #67064 [Csd->Sus]: Countable interface prevents using 2nd parameter ($mode) of count() function
- ab@php.netBug #67064 [Sus->Csd]: Countable interface prevents using 2nd parameter ($mode) of count() function
- boen dot robot at gmail dot comBug #67064 [Com]: Countable interface prevents using 2nd parameter ($mode) of count() function