1--TEST-- 2Bug GH-8591 004 (JIT does not account for class re-compile) 3--EXTENSIONS-- 4opcache 5--INI-- 6opcache.enable=1 7opcache.enable_cli=1 8opcache.jit_buffer_size=1M 9opcache.jit=1255 10opcache.file_update_protection=0 11opcache.revalidate_freq=0 12opcache.protect_memory=1 13--FILE-- 14<?php 15 16// Checks that JITed code does not crash in --repeat 2 after the ModelTrait 17// trait is recompiled and Model is re-linked. 18 19require __DIR__ . '/gh8591-004.inc'; 20 21class Model 22{ 23 use ModelTrait; 24 25 protected static int $field = 1; 26 27 public function __construct() 28 { 29 for ($i = 0; $i < 10; $i++) { 30 $this->cast(); 31 } 32 } 33 34 private function cast() 35 { 36 global $x; 37 $x = static::$field; 38 } 39} 40 41new Model(); 42 43// mark the file as changed (important) 44touch(__DIR__ . '/gh8591-004.inc'); 45 46var_dump($x); 47 48print "OK"; 49--EXPECT-- 50int(1) 51OK 52