Skip to content

Prevent PHP warning reading property on null in WP_Query::is_singular()#3142

Open
remyperona wants to merge 3 commits intoWordPress:trunkfrom
wp-media:56188
Open

Prevent PHP warning reading property on null in WP_Query::is_singular()#3142
remyperona wants to merge 3 commits intoWordPress:trunkfrom
wp-media:56188

Conversation

@remyperona
Copy link

@remyperona remyperona commented Aug 26, 2022

get_queried_object() can return null, but there was no check for its value before trying to read the post_type property from the value.

Trac ticket: https://core.trac.wordpress.org/ticket/56188 + https://core.trac.wordpress.org/ticket/29660


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@jrfnl
Copy link
Member

jrfnl commented Sep 6, 2022

Please add a test covering this change.

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.

2 participants