php-src/ext/opcache/tests/preload_trait_multiple_fixup.inc
Nikita Popov 6808968c89 Backport preloading trait fixup fixes
This cherry-picks 33969c2252 and
2effbfd871 from PHP-8.0.

The issues these commits fix could also manifest in PHP 7.4, and
a commenter on bug #80307 reports this this might indeed be
happening.
2020-11-05 16:35:08 +01:00

33 lines
465 B
PHP

<?php
trait T1 {
public function method() {
// Needs to be optimized somehow.
$str = "Foo";
echo "$str\n";
}
}
trait T2 {}
class C1 {
use T1;
}
class C2 extends C1 {
use T2;
}
trait T3 {
public function method() {
// Prevent trivial inheritance.
static $x;
// Needs to be optimized somehow.
$str = "Foo";
echo "$str\n";
}
}
class C3 {
use T3;
}
class C4 extends C3 {}