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

Fix 'Trying to access array offset on value of type bool' in WP 5.0-5.2 #1841

Merged
merged 1 commit into from Aug 5, 2022

Conversation

IanDelMar
Copy link
Contributor

Description

This PR adds true as the second argument to add_theme_support( 'post-thumbails' ).

Motivation and Context

Prior to version 5.3 calling add_theme_support( 'post-thumbails' ) without the second argument makes WP try to access the index of a variable with value true. PHP throws a 'Trying to access array offset on value of type bool' notice. As Understrap currently supports WP versions back to version 5.0 we should fix this.

See https://github.com/WordPress/WordPress/blob/d1e96dfce29333740f8a5042e2e760746ede89ea/wp-includes/theme.php#L2340-L2362 (WP 5.2.15) for the code causing the notice and see https://github.com/WordPress/WordPress/blob/6d40400756c0dc14c7f9aac1e60f6a84fc428b3d/wp-includes/theme.php#L2385-L2405 (WP 5.3) for the code fixing the notice.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I pulled my branch from develop.
  • I am submitting my pull request to develop.
  • I have resolved any conflicts merging this pull request would create.
  • I have checked that there aren't other open Pull Requests for the same update/change.
  • My code follows the code style of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • (Optional) My change requires a change to the documentation.
  • (Optional) I have updated the documentation accordingly.
  • (Optional) My change requires a change to the translations.
  • (Optional) I have updated the translations accordingly.
  • composer cs:check has passed locally.
  • composer lint:php has passed locally.
  • I have read the CONTRIBUTING document.

Related Issues or Roadmap requests

Further comments

@IanDelMar
Copy link
Contributor Author

@bacoords safe to merge

@bacoords bacoords merged commit 3769f3c into understrap:develop Aug 5, 2022
@IanDelMar IanDelMar deleted the post-thumbnails branch August 5, 2022 15:47
IanDelMar added a commit to IanDelMar/understrap that referenced this pull request Aug 8, 2022
IanDelMar added a commit to IanDelMar/understrap that referenced this pull request Aug 8, 2022
@IanDelMar IanDelMar mentioned this pull request Aug 8, 2022
17 tasks
bacoords added a commit that referenced this pull request Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants