Skip to content

Delayed early binding can report wrong lineno #16508

Closed

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

Activity

  1. added 2 commits that reference this issue on Oct 21, 2024
    a5e3210
    2d068c4
  2. andypost commented on Oct 22, 2024

    @andypost
    Contributor

    btw Building PHP 8.4.0RC3 I see that commit 5a639c5 is wrong and the test failed

    TEST 3342/18488 [Zend/tests/gh16508.phpt]
    ========DIFF========
    001- Fatal error: Class Test2 contains 1 abstract method and must therefore be declared abstract or implement the remaining method (Test::foo) in %s on line 5
    001+ Fatal error: Class Test2 contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Test::foo) in /builds/alpine/aports/testing/php84/src/php-8.4.0RC3/Zend/tests/gh16508.php on line 5
    ========DONE========
    
  3. iluuu1994 commented on Oct 22, 2024

    @iluuu1994
    Member

    @andypost Thank you. I fixed it now, but unfortunately 8.4.0RC3 is tagged, so this will fail until the next RC.

  4. andypost commented on Oct 22, 2024

    @andypost
    Contributor

    Thank you, added as patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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