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

From: Date: Wed, 05 Jul 2017 06:45:20 +0000
Subject: Bug #74102 [Com]: Dump print_r buffer on out of memory error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209817@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74102&edit=1 ID: 74102 Comment by: rmoisto at gmail dot com Reported by: daniel at krol dot me Summary: Dump print_r buffer on out of memory error Status: Open Type: Bug Package: Output Control Operating System: OSX, Ubuntu PHP Version: 7.0.15 Block user comment: N Private report: N New Comment: This is security issue as it exposes variables to the end user that were supposed to be private. Previous Comments: ------------------------------------------------------------------------ [2017-02-15 13:36:53] daniel at krol dot me 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 this bug report at https://bugs.php.net/bug.php?id=74102&edit=1

« previous php.bugs (#209817) next »