Skip to content

Commit 9e1af93

Browse files
committed
Fix lineno for inheritance errors of early bound classes
1 parent fe51365 commit 9e1af93

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

Zend/tests/gh16508.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
GH-16508: Missing lineno in inheritance errors of delayed early bound classes
3+
--EXTENSIONS--
4+
opcache
5+
--INI--
6+
opcache.enable_cli=1
7+
--FILE--
8+
<?php
9+
10+
new Test2;
11+
12+
class Test2 extends Test {}
13+
14+
abstract class Test {
15+
abstract function foo();
16+
}
17+
18+
?>
19+
--EXPECTF--
20+
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

Zend/zend_inheritance.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3222,6 +3222,8 @@ ZEND_API zend_class_entry *zend_try_early_bind(zend_class_entry *ce, zend_class_
32223222
CG(current_linking_class) = is_cacheable ? ce : NULL;
32233223

32243224
zend_try{
3225+
CG(zend_lineno) = ce->info.user.line_start;
3226+
32253227
if (is_cacheable) {
32263228
zend_begin_record_errors();
32273229
}

0 commit comments

Comments
 (0)