Skip to content

Commit 2d068c4

Browse files
committed
Fix lineno for inheritance errors of early bound classes
Fixes GH-16508 Closes GH-16532
1 parent de7ef3f commit 2d068c4

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ PHP NEWS
1717
call trampoline). (ilutov)
1818
. Fixed bug GH-16509 (Incorrect line number in function redeclaration error).
1919
(ilutov)
20+
. Fixed bug GH-16508 (Incorrect line number in inheritance errors of delayed
21+
early bound classes). (ilutov)
2022

2123
- Curl:
2224
. Fixed bug GH-16302 (CurlMultiHandle holds a reference to CurlHandle if

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)