Bug #65867 [NEW]: strace php -r 'class A implements Countable {function count() {return count($th
| From: | kakserpompoyaitsam at gmail dot com | Date: | Wed, 09 Oct 2013 04:44:31 +0000 |
| Subject: | Bug #65867 [NEW]: strace php -r 'class A implements Countable {function count() {return count($th | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-182094@lists.php.net to get a copy of this message | ||
From: kakserpompoyaitsam at gmail dot com
Operating system: Irrelevant
PHP version: 5.5.4
Package: SPL related
Bug Type: Bug
Bug description:strace php -r 'class A implements Countable {function count() {return count($th
Description:
------------
Easy reproducible segmentation fault.
It seems that count($this) doesn't check recursion. I think that
count($this) should check if it is called inside of $this->count(), and
if so, should ignore the Countable interface and just count the
properties. Use case: if your object got special properties that you do
not want to count, you can use something liek that: "function count()
{return count($this) - numberOfSpecialProperties;}"
Test script:
---------------
class A implements Countable {function count() {return count($this);}}
count(new A);
Expected result:
----------------
0
Actual result:
--------------
Segmentation fault.
--
Edit bug report at https://bugs.php.net/bug.php?id=65867&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=65867&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=65867&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=65867&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=65867&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=65867&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=65867&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=65867&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=65867&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=65867&r=support
Expected behavior: https://bugs.php.net/fix.php?id=65867&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=65867&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=65867&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=65867&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65867&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=65867&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=65867&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=65867&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65867&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=65867&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=65867&r=mysqlcfg