From: Operating system: CentOs PHP version: 5.3.6 Package: Reproducible crash Bug Type: Bug Bug description:PHP crashes when passing large object to string functions
Description: ------------ PHP crashes when passing large object ( with __toString() method ) to string functions (like substr(), urlencode() etc.) Test script: --------------- <?php class Foo { protected $obj; function rec($i = 0, $obj) { $this -> obj = $obj; // >5603 - segmentation fault or zend_mm_heap corrupted // With some values can work as expected if ( $i < 15604) { $this -> rec(++$i, $this); } } function __toString() { $this -> rec(0, $this); return "Hello, world!"; } } $foo = new Foo(); substr($foo, 0, 5); // This is ok //echo "\nHello!\n"; // But if we begin using variables "zend_mm_heap corrupted" or "Segmentation Fault" $a = "aaaaa\n"; echo $a; ?> Expected result: ---------------- Expecting correct appication exit Actual result: -------------- "Segmentation Fault" or "zend_mm_heap corrupted" errors -- Edit bug report at http://bugs.php.net/bug.php?id=54465&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54465&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54465&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54465&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=54465&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54465&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=54465&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=54465&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=54465&r=needscript Try newer version: http://bugs.php.net/fix.php?id=54465&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=54465&r=support Expected behavior: http://bugs.php.net/fix.php?id=54465&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=54465&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=54465&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=54465&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54465&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=54465&r=dst IIS Stability: http://bugs.php.net/fix.php?id=54465&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=54465&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=54465&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=54465&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=54465&r=mysqlcfg