From 61d2a8383ddc7b6bb5bfee93ef0f0f2ba560f9da Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Wed, 14 Mar 2007 23:47:19 +0000 Subject: [PATCH] don't emit any warnings in addition to an exception --- ext/pcre/php_pcre.c | 4 +++- ext/pcre/tests/preg_replace_callback2.phpt | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index e827ac64bd..865b5c7d26 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -912,7 +912,9 @@ static int preg_do_repl_func(zval *function, char *subject, int *offsets, int co result_len = Z_STRLEN_P(retval_ptr); zval_ptr_dtor(&retval_ptr); } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call custom replacement function"); + if (!EG(exception)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call custom replacement function"); + } result_len = offsets[1] - offsets[0]; *result = estrndup(&subject[offsets[0]], result_len); } diff --git a/ext/pcre/tests/preg_replace_callback2.phpt b/ext/pcre/tests/preg_replace_callback2.phpt index e5e0e79ddd..e46aa556d0 100644 --- a/ext/pcre/tests/preg_replace_callback2.phpt +++ b/ext/pcre/tests/preg_replace_callback2.phpt @@ -22,7 +22,6 @@ var_dump(preg_replace_callback('~\A.~', 'g', array(array('xyz')))); var_dump(preg_replace_callback('~\A.~', create_function('$m', 'return strtolower($m[0]);'), 'ABC')); ?> --EXPECTF-- -Warning: preg_replace_callback(): Unable to call custom replacement function in %spreg_replace_callback2.php on line %d array(3) { [0]=> string(12) "'a' 'b3' bcd" @@ -39,7 +38,6 @@ array(1) { } string(3) "aBC" --UEXPECTF-- -Warning: preg_replace_callback(): Unable to call custom replacement function in %s on line %d array(3) { [0]=> unicode(12) "'a' 'b3' bcd" -- 2.50.1