|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2018-07-27 20:52 UTC] nikic@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: nikic
[2018-07-27 20:52 UTC] nikic@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 17:00:01 2025 UTC |
Description: ------------ When memory usage exceeds the memory limit during the execution of regular-expression related functions (such as preg_replace, preg_replace_callback, etc), instead of triggering the error that you would normally get when exceeding the memory limit, php execution is simply abruptly aborted (it crashes?) and produces empty output, regardless of whether you have display_errors set to true and/or have set an error handler. Test script: --------------- // PSEUDOCODE ini_set('memory_limit', $some_low_limit); $s="a huge string (not big enough to exceed the memory limit itself"; preg_replace_callback( "/some_complex_regex_with_a_lot_of_matches/", function($match) { return whatever; }, $s ); Expected result: ---------------- Should trigger the memory-limit error in the same way as when you exceed the memory limit without regular expressions. With display_errors set to true, you should see an error message Actual result: -------------- crashes and produces a f*****g blank page, even if display_errors is set to true, and you have no way of debugging what the f**k is going on. Took me ages to narrow it down to regular expressions.