Re: Bug in pcre (pcre.backtrack_limit)?
| From: | Felipe Pena | Date: | Wed, 30 Jan 2008 20:43:38 +0000 |
| Subject: | Re: Bug in pcre (pcre.backtrack_limit)? | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-35044@lists.php.net to get a copy of this message | ||
Hello
Em Qua, 2008-01-30 às 20:57 +0100, Karl Pflästerer escreveu:
> Hi,
> when pcre.backtrack_limit is reached with preg_replace() the subject
> string gets truncated to a string of length zero.
I changed the phrase about the return value (3 weeks ago) in
pcre_replace(), it can be seen at http://docs.php.net/preg-replace, i
added "or NULL if an error occurred."
<?php
ini_set("pcre.backtrack_limit",10);
$s = str_repeat("a", 9999);
var_dump(preg_replace("/a(.*?)b/", "\$1", $s));
var_dump(preg_last_error()); // 2 = PREG_BACKTRACK_LIMIT_ERROR
Output:
NULL
int(2)
--
Regards,
Felipe Pena.