|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45582 Countable interface doesn't work as expected
Submitted: 2008-07-21 14:53 UTC Modified: 2008-07-29 01:00 UTC
Avg. Score:3.0 ± 1.6
Reproduced:2 of 3 (66.7%)
Same Version:1 (50.0%)
Same OS:0 (0.0%)
From: m dot golivkin at gmail dot com Assigned: fb-req-jani (profile)
Status: No Feedback Package: SPL related
PHP Version: 5.2.6 OS: CentOS release 4.6 (Final)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: m dot golivkin at gmail dot com
New email:
PHP Version: OS:


 [2008-07-21 14:53 UTC] m dot golivkin at gmail dot com
Countable interface dosen't work on server A with php 5.2.6 on CentOS as with server B with php 5.2.1 on Ubuntu 7.04.

link to phpinfo on server A:

Reproduce code:
error_reporting(E_ALL | E_STRICT);
class Foo implements Countable
        public function count()
                return 4;

$foo = new Foo();

var_dump(count($foo), $foo->count());


Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-21 16:35 UTC]
Please try using this CVS snapshot:
For Windows (zip):

For Windows (installer):

I get the expected result with latest CVS of PHP 5.2, 5.3 and 6.
 [2008-07-29 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2008-10-07 01:52 UTC] masonsu at 126 dot com
I test it with windows php-5.2.5 and there are no problems.
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC