PHPDbg misidentifies uncaught exception when exception is not yet loaded
Aperta
Nessuno ha ancora preso questa issue.
Bug
SAPI: phpdbg
Status: Needs Triage
- Lingua principale
- C
- Stelle
- 40.4k
- Fork
- 8.1k
- Merge medio
- 2g 13h
- PR unite (30g)
- 96
Descrizione
Description
The following code:
<?php declare(strict_types=1);
try {
throw new RuntimeException();
} catch (LibrarySpecificException) {
// A library specific exception. Not autoloaded since it did not happen.
} catch (RuntimeException) {
echo "Caught it. 'handled' it\n";
}
When run via php or phpdbg -qrr Resulted in this output:
Caught it. 'handled' it
But when run via phpdbg -r resulted in output:
[Welcome to phpdbg, the interactive PHP debugger, v8.5.6]
To get help using phpdbg type "help" and press enter
[Please report bugs to <https://github.com/php/php-src/issues>]
[PHP Fatal error: During class fetch: Uncaught RuntimeException in /src/demo.php:4
Stack trace:
#0 {main} in /src/demo.php on line 4
Stack trace:
#0 {main}]
>00004: throw new RuntimeException();
00005: } catch (LibrarySpecificException) {
00006: // A library specific exception. Not autoloaded since it did not happen.
prompt>
PHP Version
PHP 8.5.6 (cli) (built: May 8 2026 16:44:06) (NTS)
Copyright (c) The PHP Group
Built by https://github.com/docker-library/php
Zend Engine v4.5.6, Copyright (c) Zend Technologies
with Zend OPcache v8.5.6, Copyright (c), by Zend Technologies
PHP 8.4.20 (cli) (built: Apr 8 2026 08:16:38) (NTS gcc x86_64)
Copyright (c) The PHP Group
Built by Amazon Linux
Zend Engine v4.4.20, Copyright (c) Zend Technologies
with Zend OPcache v8.4.20, Copyright (c), by Zend Technologies
Operating System
Alpine3.22 and Amazon Linx 2023
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Riproduci lo script fornito sia con phpdbg -r sia con phpdbg -qrr, confrontandoli con php. Inizia dal percorso di esecuzione di phpdbg coinvolto nel recupero delle classi e nella gestione delle eccezioni; il lavoro è completato quando l'invocazione con -r riconosce in modo coerente la RuntimeException non intercettata e preserva il comportamento previsto di catch.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- php
- Ambito
- devtools
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 48/100