[wp-trac] [WordPress Trac] #20519: PHP Notice in get_single_template()

WordPress Trac wp-trac at lists.automattic.com
Fri Sep 14 16:16:50 UTC 2012


#20519: PHP Notice in get_single_template()
------------------------------+------------------
 Reporter:  markjaquith       |       Owner:
     Type:  defect (bug)      |      Status:  new
 Priority:  normal            |   Milestone:  3.5
Component:  Warnings/Notices  |     Version:  3.0
 Severity:  normal            |  Resolution:
 Keywords:  has-patch         |
------------------------------+------------------

Comment (by nacin):

 I think in most cases it should be enough to validate we have an object.
 So rather than:
 {{{
 if ( isset( $author->user_nicename ) )
         $templates[] = "author-{$author->user_nicename}.php";
 if ( isset( $author->ID ) )
         $templates[] = "author-{$author->ID}.php";
 }}}

 We can do:

 {{{
 if ( $author ) {
         $templates[] = "author-{$author->user_nicename}.php";
         $templates[] = "author-{$author->ID}.php";
 }
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20519#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list