php / php/php-src

PHPDbg misidentifies uncaught exception when exception is not yet loaded

オープン
#22,168 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Bug SAPI: phpdbg Status: Needs Triage
主要言語
C
スター
40.4k
フォーク
8.1k
平均マージ
2日 13時間
マージ済み PR(30日)
96

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

提供されたスクリプトを phpdbg -rphpdbg -qrr の両方で再現し、php と比較します。クラス取得と例外処理に関係する phpdbg の実行パスから始めます; 完了条件は、-r の呼び出しがキャッチされていない RuntimeException を一貫して認識し、期待される catch の動作を維持することです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
php
領域
devtools
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。