I find that if I try to use preg_replace on a very long string, PHP returns an empty page to my browser without showing an error message. I was able to reproduce this bug in my testing environment. What is the maximum length of a string that preg_replace can handle? Is it possible to increase this length?
The same happened to me for $pattern matching string over 4M. Probably you will have to increase pcre.backtrack_limit using ini_set() or editing php.ini.
Check preg for last error:
$retval = preg_replace ($pattern, $replacement, $subject);
if ($retval === null) {
// see http://php.net/manual/en/function.preg-last-error.php
echo preg_last_error();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With