Bug #67064 [NEW]: Countable interface prevents using 2nd parameter ($mode) of count() function

From: Date: Sun, 13 Apr 2014 17:09:04 +0000
Subject: Bug #67064 [NEW]: Countable interface prevents using 2nd parameter ($mode) of count() function
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-185211@lists.php.net to get a copy of this message
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)

« previous php.bugs (#185211) next »