[wp-trac] [WordPress Trac] #23340: get_page_template_slug( $post_id = null ) needs hardening against the null scenario
WordPress Trac
noreply at wordpress.org
Thu Jan 31 12:27:46 UTC 2013
#23340: get_page_template_slug( $post_id = null ) needs hardening against the null
scenario
-----------------------------+--------------------------
Reporter: lkraav | Type: defect (bug)
Status: new | Priority: normal
Milestone: Awaiting Review | Component: Template
Version: 3.4.2 | Severity: normal
Keywords: |
-----------------------------+--------------------------
My {{{pre_get_posts}}} action overrides a plugin's query:
{{{
$q->init();
$q->set( "page_id", icl_object_id( get_option( "mp_store_page" ), "page",
true ) );
$q->parse_query();
}}}
This causes, among other things:
{{{
NOTICE: wp-includes/post-template.php:1270 - Trying to get property of
non-object
}}}
To me, it looks strange that the function's signature sort of accounts for
this scenario, but in the function there's no handling for when it
actually happens at
{{{
if ( 'page' != $post->post_type )
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/23340>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list