-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add type check user cpt array #45275
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If $user_cpt was null
I think this would still create a notice?
TBH I don't quite see why? |
FWIW, I don't mind adding the Ideally, I'd like to be able to reproduce the issue (see) and verify the fix. Finally, I'd like to understand which code path leads to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, LGTM. See #45275 (comment) for some more thoughts.
I'm a bit hesitant to add a type check here without understanding what's actually going on at a deeper level. I worry this could be silencing an error that would alert someone of a problem in their code. I'm a little confused as to the steps I should be using to try and reproduce this. Is the contributing factor using |
I think a unit test would be useful here. But the change looks good to me. |
Update: Per this discussion, we've decided not to include this in 6.1. Tentatively bumping to 6.1.1. |
This is no longer an issue in the plugin or in the core. See: #45240 (comment). |
@c4rl0sbr4v0, I think we can close this and the core backport PR. |
What?
Fixes #45240
Why?
If
$user_cpt
is not an array.array_key_exists( 'post_content', $user_cpt )
function can throw a Fatal error or a warning.How?
Add the
is_array()
check to the conditional.Testing Instructions
Screenshots or screencast