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

From: Date: Sat, 19 Jun 2021 07:13:52 +0000
Subject: Req #81171 [Opn->Wfx]: &$GLOBALS not allowed anymore
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-234493@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:             Open
+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:

> 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.


Previous Comments:
------------------------------------------------------------------------
[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


Thread (5 messages)

« previous php.bugs (#234493) next »