Set filename & lineno information for preload inheritance error

This commit is contained in:
Nikita Popov 2019-02-15 17:03:57 +01:00
parent 92fae00ee0
commit 1b31b45f6f
2 changed files with 9 additions and 2 deletions

View file

@ -3335,7 +3335,14 @@ static void preload_link(void)
zv = zend_hash_set_bucket_key(EG(class_table), (Bucket*)zv, key); zv = zend_hash_set_bucket_key(EG(class_table), (Bucket*)zv, key);
zend_string_release(key); zend_string_release(key);
if (EXPECTED(zv)) { 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); zend_do_link_class(ce, parent);
CG(in_compilation) = 0;
CG(compiled_filename) = NULL;
changed = 1; changed = 1;
} }
} }

View file

@ -11,5 +11,5 @@ opcache.preload={PWD}/preload_inheritance_error_ind.inc
<?php <?php
echo "Foobar\n"; echo "Foobar\n";
?> ?>
--EXPECT-- --EXPECTF--
Fatal error: Declaration of B::foo($bar) must be compatible with A::foo() in Unknown on line 0 Fatal error: Declaration of B::foo($bar) must be compatible with A::foo() in %spreload_inheritance_error.inc on line 7