Req #81171 [Wfx]: &$GLOBALS not allowed anymore

From: Date: Sat, 19 Jun 2021 07:20:58 +0000
Subject: Req #81171 [Wfx]: &$GLOBALS not allowed anymore
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-234494@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81171&edit=1 ID: 81171 Updated by: nikic@php.net Reported by: herbert at groot dot jebbink dot nl Summary: &$GLOBALS not allowed anymore Status: Wont fix Type: Feature/Change Request Package: Arrays related Operating System: Linux PHP Version: 8.1.0alpha1 Block user comment: N Private report: N New Comment: I'd be interested in what you're trying to do though, maybe I can suggest an alternative. The line you shared looks pretty odd to me, not really obvious why $GLOBALS is being assigned that way. Previous Comments: ------------------------------------------------------------------------ [2021-06-19 07:13:52] nikic@php.net > however, it would be great if the error message only happens if the usage is not lookup but > when it tries to change it. Acquiring a reference allows further indirect changes, which cannot be tracked in a fine-grained manner. If you wrote $pad_data[1][1] = $GLOBALS, that would continue to work fine. Closing this as the change is intentional and the impact on reference acquisition explicitly mentioned in the RFC. ------------------------------------------------------------------------ [2021-06-19 06:50:26] herbert at groot dot jebbink dot nl Description: ------------ Below line gives in 8.1.0alpha1 the error "SHUTDOWN: Cannot acquire reference to $GLOBALS" $pad_data [1] [1] = &$GLOBALS; I did read below page and understand that changes are good in new releases, happy that PHP evolves. https://wiki.php.net/rfc/restrict_globals_usage however, it would be great if the error message only happens if the usage is not lookup but when it tries to change it. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=81171&edit=1

« previous php.bugs (#234494) next »