Skip to content

Commit 0cee8ba

Browse files
committed
Fix GH-22168: Silence phpdbg catch class fetch
1 parent 72244e6 commit 0cee8ba

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

sapi/phpdbg/phpdbg_utils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ PHPDBG_API bool phpdbg_check_caught_ex(zend_execute_data *execute_data, zend_obj
633633
zend_class_entry *ce;
634634

635635
if (!(ce = CACHED_PTR(cur->extended_value & ~ZEND_LAST_CATCH))) {
636-
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);
636+
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);
637637
CACHE_PTR(cur->extended_value & ~ZEND_LAST_CATCH, ce);
638638
}
639639

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
GH-22168 (Exception caught by a later catch is not misreported as uncaught when an earlier catch references a non-existent class)
3+
--PHPDBG--
4+
r
5+
q
6+
--EXPECTF--
7+
[Successful compilation of %s]
8+
prompt> Caught it. 'handled' it
9+
[Script ended normally]
10+
prompt>
11+
--FILE--
12+
<?php declare(strict_types=1);
13+
14+
try {
15+
throw new RuntimeException();
16+
} catch (LibrarySpecificException) {
17+
// A library specific exception. Not autoloaded since it did not happen.
18+
} catch (RuntimeException) {
19+
echo "Caught it. 'handled' it\n";
20+
}

0 commit comments

Comments
 (0)