Override construct function with optional argument should not produce fatal error
まだ誰も着手していません。
評価
調査の方向性
PHP 8.4.24で2つのインターフェース継承スニペットを再現し、親インターフェースの順序と、それによって発生するコンストラクター互換性エラーを比較します。まず、継承されたインターフェースメソッドを検証するengineの経路を追跡します。報告されたfatal errorなしに両方の宣言順序が一貫して動作し、そのケースをカバーする回帰テストが追加されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Description
The following code:
<?php
interface MyInterface1 { public function __construct(?string $name = null); }
interface MyInterface2 { public function __construct(?string $name = null, ?int $id = null); }
interface MyInterface3 extends MyInterface1, MyInterface2 { }
Resulted in this output:
PHP Fatal error: Declaration of MyInterface1::__construct(?string $name = null) must be compatible with MyInterface2::__construct(?string $name = null, ?int $id = null) in php shell code on line 1
But I expected no error and the following code works as expected:
<?php
interface MyInterface1 { public function __construct(?string $name = null); }
interface MyInterface2 { public function __construct(?string $name = null, ?int $id = null); }
interface MyInterface4 extends MyInterface2, MyInterface1 { }
PHP Version
PHP 8.4.24 (cli) (built: Jul 30 2026 15:23:13) (NTS)
Copyright (c) The PHP Group
Built by Ubuntu
Zend Engine v4.4.24, Copyright (c) Zend Technologies
with Zend OPcache v8.4.24, Copyright (c), by Zend Technologies
Operating System
Ubuntu 24.04.4 LTS
- 主要言語
- C
- スター
- 40.4k
- フォーク
- 8.2k
- 平均マージ
- 2日 15時間
- マージ済み PR(30日)
- 103
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
php/php-src のほかの issue
-
Bug SAPI: cli_server Status: Verified
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
Bug Status: Needs Triage
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
Bug Status: Needs Triage
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
-
Bug Status: Needs Triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
Bug Category: Tests Status: Verified
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
zephyrproject-rtos/zephyr#119726 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
api7/lua-resty-saml#63 ·
-
[Bounty proposal] fix(web): memory insights count an evening memory on the next day ($25 proposed) オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
BasedHardware/omi#15320 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
[adam] AdamNet network read doesn't cap to MAX_ADAM_PACKET_LEN, overflows client receive buffers オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
FujiNetWIFI/fujinet-firmware#1649 · コメント 2 件 ·