Skip to content

Inconsistent use of E_WARNING and E_COMPILE_WARNING in zend_compile.c #18510

Open
@TimWolla

Description

@TimWolla

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions