Skip to content

Delayed early binding can report wrong lineno #16508

Closed
@cmb69

Description

@cmb69

Description

The following code:

<?php

new Test2;
class Test2 extends Test {}
abstract class Test {
    abstract function foo();
}

Resulted in this output:

Fatal error: Class Test2 contains 1 abstract method and must therefore be declared abstract or implement the remaining method (Test::foo) in C:\php-sdk\phpdev\vs17\x64\delayed.php on line 0

But I expected this output instead:

Fatal error: Class Test2 contains 1 abstract method and must therefore be declared abstract or implement the remaining method (Test::foo) in C:\php-sdk\phpdev\vs17\x64\delayed.php on line 4

The problem is that neither zend_accel_do_delayed_early_binding() nor zend_try_early_bind() set CG(zend_lineno), and as such errors report lineno 0.

This has been found due to a00c734, but is a more general issue that not only affects Windows.

I haven't checked older branches, but these may be affected as well.

PHP Version

master

Operating System

any

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