PHPDbg misidentifies uncaught exception when exception is not yet loaded
Ouverte
Personne n'a encore pris cette issue.
Bug
SAPI: phpdbg
Status: Needs Triage
- Langage dominant
- C
- Étoiles
- 40.4k
- Forks
- 8.1k
- Merge moyen
- 2 j 13 h
- PR mergées (30 j)
- 96
Description
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
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Reproduisez le script fourni avec phpdbg -r et phpdbg -qrr, en les comparant à php. Commencez par le chemin d’exécution de phpdbg impliqué dans la récupération des classes et la gestion des exceptions ; c’est terminé lorsque l’invocation avec -r reconnaît systématiquement la RuntimeException non interceptée et préserve le comportement attendu de catch.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- php
- Domaine
- devtools
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- Calme
- Clarté
- Plutôt claire
- Accessibilité débutants
- 48/100