php / php/php-src

Inconsistent use of E_WARNING and E_COMPILE_WARNING in zend_compile.c

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

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

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

説明

Description

The following code:

<?php

set_error_handler(function (int $errno, string $errstr) {
	var_dump($errno, $errstr);
}, E_ALL);

include('test7.php');

and

<?php

use Foo;

function foo(integer $foo) {
	
}

Resulted in this output:

int(2)
string(60) "The use statement with non-compound name 'Foo' has no effect"

Warning: "integer" will be interpreted as a class name. Did you mean "int"? Write "\integer" to suppress this warning in php-src/test7.php on line 5

But I expected this output instead:

Warning: The use statement with non-compound name 'Foo' has no effect in php-src/test7.php on line 3

Warning: "integer" will be interpreted as a class name. Did you mean "int"? Write "\integer" to suppress this warning in php-src/test7.php on line 5

or

int(2)
string(60) "The use statement with non-compound name 'Foo' has no effect"
int(2)
string(108) ""integer" will be interpreted as a class name. Did you mean "int"? Write "\integer" to suppress this warning"

The same applies to other warnings emitted during compilation.

PHP Version
git master
Operating System

No response

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

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

はじめの一歩

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

調査の方向性

test7.phpを使って2つの警告例を再現し、その後、zend_compile.cの警告発行経路を調査してください。非複合使用の警告とinteger型の警告がどのように報告されるかを比較し、コンパイル警告が意図されたエラーハンドラーの動作を一貫して使用していることを確認してください。

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

評価

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

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

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