Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ PHP 8.1: New PHPCompatibility.ParameterValues.NewArrayMergeRecursiveWithGlobalsVar sniff #1488

Merged

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
41 checks passed
@wimg wimg deleted the php-8.1/new-newarraymergerecursivewithglobalsvar-sniff branch April 20, 2023 14:56
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.

None yet

2 participants