Bug #74102 [NEW]: Dump print_r buffer on out of memory error

From: Date: Wed, 15 Feb 2017 13:37:12 +0000
Subject: Bug #74102 [NEW]: Dump print_r buffer on out of memory error
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-207389@lists.php.net to get a copy of this message
From: daniel at krol dot me Operating system: OSX, Ubuntu PHP version: 7.0.15 Package: Output Control Bug Type: Bug Bug description:Dump print_r buffer on out of memory error Description: ------------ Tested on 7.0.15(Ubuntu), OSX PHP 7.0.6 (cli) (built: Apr 29 2016 04:21:39) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans and OSX PHP 5.6.21 (cli) (built: Apr 29 2016 02:31:44) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans all provide similiar result Might be related to https://bugs.php.net/bug.php?id=54114 Test script: --------------- <?php ini_set("memory_limit", "2m"); $v = array_fill(0,1024*5/2/4/2/8, "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"); while (true) { $v[] = print_r($v, true); } Expected result: ---------------- Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 581632 bytes) in /private/tmp/test.php on line 7 Call Stack: 0.0003 355824 1. {main}() /private/tmp/test.php:0 0.0012 948768 2. print_r() /private/tmp/test.php:7 Actual result: -------------- ... ... [29] => 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 [30] => 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 [31] => 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 [32] => 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 [33] => 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 [34] => 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 [35] => 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 [36] => 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 [37] => 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 [38] => 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 [39] => 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 ) ) ) ) ) ) [46] => Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 581632 bytes) in /private/tmp/test.php on line 7 Call Stack: 0.0003 355824 1. {main}() /private/tmp/test.php:0 0.0012 948768 2. print_r() /private/tmp/test.php:7 -- Edit bug report at https://bugs.php.net/bug.php?id=74102&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74102&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74102&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74102&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=74102&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=74102&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=74102&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=74102&r=needscript Try newer version: https://bugs.php.net/fix.php?id=74102&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=74102&r=support Expected behavior: https://bugs.php.net/fix.php?id=74102&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=74102&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=74102&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=74102&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74102&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=74102&r=dst IIS Stability: https://bugs.php.net/fix.php?id=74102&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=74102&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=74102&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=74102&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=74102&r=mysqlcfg

« previous php.bugs (#207389) next »