Skip to content

Commit f6536ed

Browse files
committed
MFH: remove unnecessary warning in case of exception
1 parent 7aab16c commit f6536ed

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

ext/pcre/php_pcre.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,9 @@ static int preg_do_repl_func(zval *function, char *subject, int *offsets, int co
811811
result_len = Z_STRLEN_P(retval_ptr);
812812
zval_ptr_dtor(&retval_ptr);
813813
} else {
814-
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call custom replacement function");
814+
if (!EG(exception)) {
815+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call custom replacement function");
816+
}
815817
result_len = offsets[1] - offsets[0];
816818
*result = estrndup(&subject[offsets[0]], result_len);
817819
}

ext/pcre/tests/preg_replace_callback2.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ var_dump(preg_replace_callback('~\A.~', 'g', array(array('xyz'))));
2222
var_dump(preg_replace_callback('~\A.~', create_function('$m', 'return strtolower($m[0]);'), 'ABC'));
2323
?>
2424
--EXPECTF--
25-
Warning: preg_replace_callback(): Unable to call custom replacement function in %spreg_replace_callback2.php on line %d
2625
array(3) {
2726
[0]=>
2827
string(12) "'a' 'b3' bcd"

0 commit comments

Comments
 (0)