From ea87d0480fbfcdd1610bb56e680f64840b233b0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Tue, 25 Aug 2020 18:06:07 +0200 Subject: Promote warnings to exceptions in ext/pcre Closes GH-6006 --- ext/pcre/php_pcre.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'ext/pcre/php_pcre.c') diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index acaeb19dc6..801d19fc4f 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -1193,8 +1193,8 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, zend_string *subject_str, } if ((global && (subpats_order < PREG_PATTERN_ORDER || subpats_order > PREG_SET_ORDER)) || (!global && subpats_order != 0)) { - php_error_docref(NULL, E_WARNING, "Invalid flags specified"); - return; + zend_argument_value_error(4, "must be a PREG_* constant"); + RETURN_THROWS(); } } else { offset_capture = 0; @@ -2410,9 +2410,7 @@ PHP_FUNCTION(preg_replace_callback_array) } if (!zend_is_callable_ex(replace, NULL, 0, NULL, &fcc, NULL)) { - zend_string *callback_name = zend_get_callable_name(replace); - zend_type_error("'%s' is not a valid callback", ZSTR_VAL(callback_name)); - zend_string_release_ex(callback_name, 0); + zend_argument_type_error(1, "must contain only valid callbacks"); RETURN_THROWS(); } -- cgit v1.2.1