php.net |  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
Votes:3
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
Have you experienced this issue?
Rate the importance of this bug to you:

 [2008-07-21 14:53 UTC] m dot golivkin at gmail dot com
Description:
------------
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:  http://www.asmeniniai-finansai.lt/phpinfo.php

Reproduce code:
---------------
<?php
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:
----------------
int(4)
int(4)


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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-21 16:35 UTC] jani@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows (zip):
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

For Windows (installer):

  http://snaps.php.net/win32/php5.2-win32-installer-latest.msi

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-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC