Skip to content

Fix lineno for inheritance errors of early bound classes #16532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Zend/tests/gh16508.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--TEST--
GH-16508: Missing lineno in inheritance errors of delayed early bound classes
--EXTENSIONS--
opcache
--INI--
opcache.enable_cli=1
--FILE--
<?php

new Test2;

class Test2 extends Test {}

abstract class Test {
abstract function foo();
}

?>
--EXPECTF--
Fatal error: Class Test2 contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Test::foo) in %s on line 5
2 changes: 2 additions & 0 deletions Zend/zend_inheritance.c
Original file line number Diff line number Diff line change
Expand Up @@ -3222,6 +3222,8 @@ ZEND_API zend_class_entry *zend_try_early_bind(zend_class_entry *ce, zend_class_
CG(current_linking_class) = is_cacheable ? ce : NULL;

zend_try{
CG(zend_lineno) = ce->info.user.line_start;

if (is_cacheable) {
zend_begin_record_errors();
}
Expand Down
Loading