diff --git a/sapi/phpdbg/phpdbg_utils.c b/sapi/phpdbg/phpdbg_utils.c index 758f75766c81..c73da4199963 100644 --- a/sapi/phpdbg/phpdbg_utils.c +++ b/sapi/phpdbg/phpdbg_utils.c @@ -633,7 +633,7 @@ PHPDBG_API bool phpdbg_check_caught_ex(zend_execute_data *execute_data, zend_obj zend_class_entry *ce; if (!(ce = CACHED_PTR(cur->extended_value & ~ZEND_LAST_CATCH))) { - ce = zend_fetch_class_by_name(Z_STR_P(RT_CONSTANT(cur, cur->op1)), Z_STR_P(RT_CONSTANT(cur, cur->op1) + 1), ZEND_FETCH_CLASS_NO_AUTOLOAD); + ce = zend_fetch_class_by_name(Z_STR_P(RT_CONSTANT(cur, cur->op1)), Z_STR_P(RT_CONSTANT(cur, cur->op1) + 1), ZEND_FETCH_CLASS_NO_AUTOLOAD | ZEND_FETCH_CLASS_SILENT); CACHE_PTR(cur->extended_value & ~ZEND_LAST_CATCH, ce); } diff --git a/sapi/phpdbg/tests/exceptions_004.phpt b/sapi/phpdbg/tests/exceptions_004.phpt new file mode 100644 index 000000000000..fca56b417600 --- /dev/null +++ b/sapi/phpdbg/tests/exceptions_004.phpt @@ -0,0 +1,20 @@ +--TEST-- +GH-22168 (Exception caught by a later catch is not misreported as uncaught when an earlier catch references a non-existent class) +--PHPDBG-- +r +q +--EXPECTF-- +[Successful compilation of %s] +prompt> Caught it. 'handled' it +[Script ended normally] +prompt> +--FILE-- +