Skip to content

Conversation

@jrfnl
Copy link
Member

@jrfnl jrfnl commented Apr 5, 2023

This change is a side-effect of the "Remove Indirect Modification of $GLOBALS" RFC, which removed the recursive $GLOBALS['GLOBALS'] key from the $GLOBALS array. Also see PR #1487

Access to the $GLOBALS array is now subject to a number of restrictions.
Read and write access to individual array elements like $GLOBALS['var']
continues to work as-is. Read-only access to the entire $GLOBALS array also
continues to be supported. However, write access to the entire $GLOBALS
array is no longer supported. For example, array_pop($GLOBALS) will result
in an error.

Refs:

Includes unit tests.
Includes XML docs.

Related to #1299

…veWithGlobalsVar` sniff

This change is a side-effect of the "Remove Indirect Modification of $GLOBALS" RFC, which removed the recursive `$GLOBALS['GLOBALS']` key from the `$GLOBALS` array.

> Access to the $GLOBALS array is now subject to a number of restrictions.
> Read and write access to individual array elements like $GLOBALS['var']
> continues to work as-is. Read-only access to the entire $GLOBALS array also
> continues to be supported. However, write access to the entire $GLOBALS
> array is no longer supported. For example, array_pop($GLOBALS) will result
> in an error.

Refs:
* https://www.php.net/manual/en/migration81.incompatible.php#migration81.incompatible.core.globals-access
* https://github.com/php/php-src/blob/28a1a6be0873a109cb02ba32784bf046b87a02e4/UPGRADING#L23-L29
* https://wiki.php.net/rfc/restrict_globals_usage
* php/php-src#6487

Includes unit tests.
Includes XML docs.
@wimg wimg merged commit e878b5b into develop Apr 20, 2023
@wimg wimg deleted the php-8.1/new-newarraymergerecursivewithglobalsvar-sniff branch April 20, 2023 14:56
@jrfnl jrfnl added the PHP: 8.1 label Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants