"internal error" in ReflectionParameter::getDefaultValue on Variable-length argument list
オープン
Bug
Extension: reflection
Status: Verified
- 主要言語
- C
- スター
- 40.4k
- フォーク
- 8.1k
- 平均マージ
- 2日 13時間
- マージ済み PR(30日)
- 96
説明
Description
The following code:
<?php
declare(strict_types=1);
function f(...$args){
echo "see? arguments are optional.\n";
}
f();
$ref = new ReflectionFunction('f');
var_dump($ref->getParameters()[0]->getDefaultValue());
Resulted in this output:
see? arguments are optional.
Fatal error: Uncaught ReflectionException: Internal error: Failed to retrieve the default value in /in/gHhJ2:8
Stack trace:
#0 /in/gHhJ2(8): ReflectionParameter->getDefaultValue()
#1 {main}
thrown in /in/gHhJ2 on line 8
But I expected this output instead:
see? arguments are optional.
array(0) {
}
3v4l: https://3v4l.org/gHhJ2
PHP Version
8.2.11
Operating System
windows 10
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、提供された PHP 8.2.11 のスニペットを再現し、可変長パラメータに対する ReflectionParameter::getDefaultValue() のエントリーポイントを追跡します。呼び出しで内部エラーが発生しなくなり、期待される空の配列が生成されれば、変更は完了です。リンクされたオープンな pull request により、その作業がすでに進行中であることが示されています。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- c, php
- 領域
- backend
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 25/100