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 fatal error in in_array call in post_type_default_rendering_mode #67225

Merged
merged 1 commit into from
Nov 22, 2024

Conversation

jsnajdr
Copy link
Member

@jsnajdr jsnajdr commented Nov 22, 2024

Fixes a fatal error in in_array call when a supports arg of register_post_type is a boolean false. The error was introduced in #62304. See also https://github.com/WordPress/gutenberg/pull/62304/files#r1853540430.

I'm fixing this by calling empty( ... ) instead of isset( ... ). empty does the job of both checking that a variable is defined and also that it's not false. Used also at other places for similar checks, guarding a in_array call.

FYI @TylerB24890.

@jsnajdr jsnajdr added the [Type] Bug An existing feature does not function as intended label Nov 22, 2024
@jsnajdr jsnajdr requested a review from youknowriad November 22, 2024 09:12
@jsnajdr jsnajdr self-assigned this Nov 22, 2024
Copy link
Member

@fabiankaegy fabiankaegy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the fix! Very good to know supports supports a bool also 👍

Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: jsnajdr <[email protected]>
Co-authored-by: fabiankaegy <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@jsnajdr jsnajdr added the No Core Sync Required Indicates that any changes do not need to be synced to WordPress Core label Nov 22, 2024
@jsnajdr jsnajdr enabled auto-merge (squash) November 22, 2024 09:32
@jsnajdr jsnajdr merged commit 2919c5c into trunk Nov 22, 2024
72 of 74 checks passed
@jsnajdr jsnajdr deleted the fix/post-supports-crash branch November 22, 2024 09:47
@github-actions github-actions bot added this to the Gutenberg 19.8 milestone Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
No Core Sync Required Indicates that any changes do not need to be synced to WordPress Core [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants