|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-04-12 19:33 UTC] johannes@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 15:00:01 2025 UTC |
Description: ------------ If an implementation of Countable::count() does not return an int the result is a big, "random" number. It seems like the result is always taken as int even if it's a string or float. IMHO the result should get typecasted to an int or at least a warning. If I typecast the result to an int in the return statement it works as expected. Reproduce code: --------------- <?php error_reporting(E_ALL | E_STRICT); class Test implements Countable { function count() { return '1'; } } $test = new Test(); var_dump(count($test)); ?> Expected result: ---------------- int(1) Actual result: -------------- int(148313044)