LightArray: make collectGarbage() more preload-friendly

opcache preloading doesn't store non-class constants, but it does store class constants. Class constants that reference non-class constants are pre-resolved into values before storing in opcache SHM, so class constants are OK to use, but non-class constants will come back as undefined.
This commit is contained in:
Dylan K. Taylor 2020-09-04 17:23:23 +01:00
parent b81cc671e9
commit a68b0b1f93

View File

@ -82,10 +82,10 @@ final class LightArray{
* reference to the const instead of duplicating the whole string. The string will only be duplicated when
* modified, which is perfect for this purpose.
*/
if($this->data === ZERO_NIBBLE_ARRAY){
$this->data = ZERO_NIBBLE_ARRAY;
}elseif($this->data === FIFTEEN_NIBBLE_ARRAY){
$this->data = FIFTEEN_NIBBLE_ARRAY;
if($this->data === self::ZERO){
$this->data = self::ZERO;
}elseif($this->data === self::FIFTEEN){
$this->data = self::FIFTEEN;
}
}