mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
d836046ab8
It is very hard to determine in advance whether class linking will fail due to missing dependencies in variance checks (#7314 attempts this). This patch takes an alternative approach where we try to perform inheritance on a copy of the class (zend_lazy_class_load) and then restore the original class if inheritance fails. The fatal error in that case is recorded and thrown as a warning later. Closes GH-7319.
29 lines
677 B
PHP
29 lines
677 B
PHP
--TEST--
|
|
Argument/return types must be available for preloading
|
|
--INI--
|
|
opcache.enable=1
|
|
opcache.enable_cli=1
|
|
opcache.optimization_level=-1
|
|
opcache.preload={PWD}/preload_variance_ind.inc
|
|
--EXTENSIONS--
|
|
opcache
|
|
--SKIPIF--
|
|
<?php
|
|
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
interface K {}
|
|
interface L extends K {}
|
|
require __DIR__ . '/preload_variance.inc';
|
|
|
|
$a = new A;
|
|
$b = new B;
|
|
$d = new D;
|
|
$f = new F;
|
|
$g = new G;
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Warning: Can't preload unlinked class H: Could not check compatibility between H::method($a): L and G::method($a): K, because class L is not available in %spreload_variance.inc on line 43
|