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