php 7 - PHP Invalid output of get_class_vars() after enabling (opcache.so) extension
one text
I have this simple code that demonstrates updating a static value:
<?php
class myClass
{
// empty static var
public static $prop1;
}
myClass::$prop1 = array("Hey, I'm setting your value now");
var_dump(myClass::$prop1);
$allVars = get_class_vars( myClass::class ) ;
var_dump ( $allVars );
So I'm expecting both dumps to show the new value. While it works perfectly when (opcache) not enabled. But then it gives a bizarre output when (opcache) is enabled..
Is there any config responsible about this behavior ?
PHP 7.4.14
1-PHP 7.4.14 without opcache.so (OK)
array (size=1) 0 => string 'Hey, I'm setting your value now' (length=31)
array (size=1) 'prop1'
array (size=1) 0 => string 'Hey, I'm setting your value now' (length=31)
2-PHP 7.4.14 with opcache.so enabled (Not ok, odd)
array(1) { [0]=> string(31) "Hey, I'm setting your value now" }
array(1) { ["prop1"]=> NULL }
What do you think ?
Source