#41788 [Opn->Bgs]: preg_replace_callback returns NULL instead of input or error
| From: | johannes@php.net | Date: | Sun, 24 Jun 2007 14:24:50 +0000 |
| Subject: | #41788 [Opn->Bgs]: preg_replace_callback returns NULL instead of input or error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-114118@lists.php.net to get a copy of this message | ||
ID: 41788
Updated by: johannes@php.net
Reported By: Sjon at hortensius dot net
-Status: Open
+Status: Bogus
Bug Type: Regexps related
Operating System: linux 2.6.21.5
PHP Version: 5.2.3
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
See preg_last_error().
Previous Comments:
------------------------------------------------------------------------
[2007-06-24 11:44:45] Sjon at hortensius dot net
Description:
------------
The preg_replace_callback manual-entry says:
If matches are found, the new subject will be returned, otherwise
subject will be returned unchanged.
However; I have a testcase where no input is returned; and my callback
isn't called either. This seems to be caused by a required
pcre.backtrack_limit of 10000000
Shouldn't PHP return the input or an error giving some pointers about
this limit being reached?
Reproduce code:
---------------
<?PHP
$input = '{?value==input.value}';
$regexp = '~\{\?(?:\(?!?.+(==)?.+\)?)+\}{\1\/}~sU';
var_dump(preg_replace_callback($regexp, 'callback', $input));
function callback(){
die('called');
}
Expected result:
----------------
I expect an error to be raised when pcre.backtrack_limit is reached
Actual result:
--------------
NULL is var_dumped
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41788&edit=1