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

Update: Unset variable set by reference after a foreach loop. #55261

Conversation

jorgefilipecosta
Copy link
Member

In PHP it is a good practice to unset $value if it was created by reference in a foreach loop, as the reference is still valid outside the loop, and this avoids accidental bugs.

@github-actions
Copy link

This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress.

If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged.

If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack.

Thank you! ❤️

View changed files
❔ lib/class-wp-theme-json-gutenberg.php

@jorgefilipecosta jorgefilipecosta added [Type] Code Quality Issues or PRs that relate to code quality Needs PHP backport Needs PHP backport to Core labels Oct 11, 2023
@jorgefilipecosta jorgefilipecosta merged commit bab057e into trunk Oct 11, 2023
51 of 52 checks passed
@jorgefilipecosta jorgefilipecosta deleted the update/unset-variable-set-by-reference-after-foreach-loop branch October 11, 2023 14:55
@github-actions github-actions bot added this to the Gutenberg 16.9 milestone Oct 11, 2023
@github-actions
Copy link

Flaky tests detected in dd8acf6.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6483982542
📝 Reported issues:

@getdave
Copy link
Contributor

getdave commented Jan 23, 2024

@jorgefilipecosta I've started the sync process for this change in:

I'd be grateful for your review.

@youknowriad youknowriad added Backported to WP Core Pull request that has been successfully merged into WP Core and removed Needs PHP backport Needs PHP backport to Core labels Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backported to WP Core Pull request that has been successfully merged into WP Core Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants