:sparkles: PHP 8.1: New `PHPCompatibility.ParameterValues.NewArrayMergeRecursiveWithGlobalsVar` sniff by jrfnl · Pull Request #1488 · PHPCompatibility/PHPCompatibility

Skip to content

Navigation Menu

Sign in

Appearance settings

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Conversation

@jrfnl

Copy link Copy Markdown

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

Reviewers

@wimg wimg wimg approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

10.0.0-alpha1

Development

Successfully merging this pull request may close these issues.

2 participants

@jrfnl @wimg