From 1b31b45f6f731fda7586cbcfd710477f21d85b8c Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 15 Feb 2019 17:03:57 +0100 Subject: [PATCH] Set filename & lineno information for preload inheritance error --- ext/opcache/ZendAccelerator.c | 7 +++++++ ext/opcache/tests/preload_006.phpt | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index f9e67efee8..3214477e63 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -3335,7 +3335,14 @@ static void preload_link(void) zv = zend_hash_set_bucket_key(EG(class_table), (Bucket*)zv, key); zend_string_release(key); if (EXPECTED(zv)) { + /* Set filename & lineno information for inheritance errors */ + CG(in_compilation) = 1; + CG(compiled_filename) = ce->info.user.filename; + CG(zend_lineno) = ce->info.user.line_start; zend_do_link_class(ce, parent); + CG(in_compilation) = 0; + CG(compiled_filename) = NULL; + changed = 1; } } diff --git a/ext/opcache/tests/preload_006.phpt b/ext/opcache/tests/preload_006.phpt index 925b9a60b8..bbecfcf947 100644 --- a/ext/opcache/tests/preload_006.phpt +++ b/ext/opcache/tests/preload_006.phpt @@ -11,5 +11,5 @@ opcache.preload={PWD}/preload_inheritance_error_ind.inc ---EXPECT-- -Fatal error: Declaration of B::foo($bar) must be compatible with A::foo() in Unknown on line 0 +--EXPECTF-- +Fatal error: Declaration of B::foo($bar) must be compatible with A::foo() in %spreload_inheritance_error.inc on line 7 -- 2.50.0