Cannot acquire reference to $GLOBALS¶
Description¶
It is not possible to create a reference to a the superglobal $GLOBALS
. The property is readonly and cannot be changed. On the other hand, references are never readonly, and provide read and write access to the data. PHP has no way to check that the reference is readonly. Hence, references on readonly properties are not allowed.
Example¶
<?php
// Cannot acquire reference to $GLOBALS
$a = &$GLOBALS;
?>
Solutions¶
Remove the readonly option on the property.
Remove the reference to the property.