Bug #67319 [NEW]: Error with an infinite recursion in __toString().

From: Date: Wed, 21 May 2014 14:57:12 +0000
Subject: Bug #67319 [NEW]: Error with an infinite recursion in __toString().
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-185884@lists.php.net to get a copy of this message
From: Sysaninster at gmail dot com Operating system: centos 6.5 PHP version: 5.5.12 Package: *General Issues Bug Type: Bug Bug description:Error with an infinite recursion in __toString(). Description: ------------ Error with an infinite recursion in __toString(). I get in CLI: Segmentation fault When I try execute this code in php-fpm, then I get an error in fpm log: [21-May-2014 16:41:48] WARNING: [pool logic] child 8686 exited on signal 11 (SIGSEGV) after 957.896252 seconds from start Test script: --------------- class foo { public $parent = null; public function __toString() { return sprintf('some %s', $this->public); } } $test = new \foo(); $test->public = $test; echo $test; Expected result: ---------------- Fatal error: Maximum function nesting level of '500' reached, aborting! in /home /sysanin/test.php on line 5 Call Stack: 0.0002 118064 1. {main}() /home/sysanin/test.php:0 0.0003 118372 2. foo->__toString() /home/sysanin/test.php:12 0.0003 118428 3. sprintf() /home/sysanin/test.php:6 0.0003 118720 4. foo->__toString() /home/sysanin/test.php:6 0.0003 118776 5. sprintf() /home/sysanin/test.php:6 0.0003 119068 6. foo->__toString() /home/sysanin/test.php:6 0.0003 119136 7. sprintf() /home/sysanin/test.php:6 0.0003 119428 8. foo->__toString() /home/sysanin/test.php:6 ... 0.0015 203708 493. sprintf() /home/sysanin/test.php:6 0.0015 204000 494. foo->__toString() /home/sysanin/test.php:6 0.0015 204056 495. sprintf() /home/sysanin/test.php:6 0.0015 204348 496. foo->__toString() /home/sysanin/test.php:6 0.0015 204404 497. sprintf() /home/sysanin/test.php:6 0.0015 204696 498. foo->__toString() /home/sysanin/test.php:6 0.0015 204752 499. sprintf() /home/sysanin/test.php:6 -- Edit bug report at https://bugs.php.net/bug.php?id=67319&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=67319&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=67319&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=67319&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=67319&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=67319&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=67319&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=67319&r=needscript Try newer version: https://bugs.php.net/fix.php?id=67319&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=67319&r=support Expected behavior: https://bugs.php.net/fix.php?id=67319&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=67319&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=67319&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=67319&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=67319&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=67319&r=dst IIS Stability: https://bugs.php.net/fix.php?id=67319&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=67319&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=67319&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=67319&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=67319&r=mysqlcfg

« previous php.bugs (#185884) next »