call_user_func special function optimization unsound with strict_types
オープン
まだ誰も着手していません。
Bug
Category: Engine
Status: Needs Triage
- 主要言語
- C
- スター
- 40.4k
- フォーク
- 8.2k
- 平均マージ
- 2日 13時間
- マージ済み PR(30日)
- 96
説明
Description
The following code:
<?php
declare(strict_types=1);
namespace Foo;
// strlen() will be called with strict_types=0, so this is legal.
var_dump(call_user_func('strlen', false));
// Called with strict_types=1
var_dump(\call_user_func('strlen', false));
Resulted in this output:
int(0)
Fatal error: Uncaught TypeError: strlen(): Argument #1 ($string) must be of type string, false given in /in/bcCZ4:10
Stack trace:
#0 /in/bcCZ4(10): strlen(false)
#1 {main}
thrown in /in/bcCZ4 on line 10
But I expected this output instead:
Well, not sure, it should be consistent I suppose
PHP Version
8.3+
Operating System
No response
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
提供された PHP 8.3+ の reproducer から始め、strict_types=1 の下で namespaced と fully qualified の call_user_func 呼び出しパスを比較します。PHP インタープリター内の特殊関数最適化を追跡し、その後、動作を一貫させて両方の呼び出しに対するカバレッジを追加します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- c, php
- 領域
- backend, compilers
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 42/100