|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2014-06-20 08:41 UTC] arjen at react dot com
[2014-06-20 13:13 UTC] johannes@php.net
-Status: Open
+Status: Duplicate
[2015-10-07 09:48 UTC] nikic@php.net
-Status: Duplicate
+Status: Open
[2015-10-07 09:48 UTC] nikic@php.net
[2015-10-07 12:07 UTC] nikic@php.net
[2017-07-05 08:26 UTC] nikic@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 00:00:02 2025 UTC |
Description: ------------ Sufficiently large nested structures will cause print_r to output its first argument, even if the second $return argument is true. From a glance at how print_r works, it appears to be using output buffering internally. If the output written to the buffer is too large, it will be implicitly flushed. This is quite a serious problem, as one can easily expose the entire application state accidentally. This has been reproduced in the FPM and CLI SAPIs. Test script: --------------- <?php ini_set('memory_limit', '512M'); $a = []; for ($i = 0; $i < 10000; $i++) { $a = [$i, $a]; } print_r($a, true); Expected result: ---------------- Blank. Actual result: -------------- Array ( [0] => 9999 [1] => Array ( [0] => 9998 [1] => Array ( [0] => 9997 [1] => Array ( ...