[wp-trac] [WordPress Trac] #24714: get_template_part : !empty instead of isset ?

WordPress Trac noreply at wordpress.org
Tue Jul 9 20:29:48 UTC 2013


#24714: get_template_part : !empty instead of isset ?
------------------------------+------------------
 Reporter:  tivnet            |       Owner:
     Type:  defect (bug)      |      Status:  new
 Priority:  normal            |   Milestone:  3.6
Component:  Template          |     Version:  3.0
 Severity:  normal            |  Resolution:
 Keywords:  has-patch commit  |
------------------------------+------------------

Comment (by nacin):

 Actually, '0' is probably valid. Think `get_template_part( 'something',
 get_query_var( 'paged' ) )` where an integer might be valid. Pagination
 generally starts with 1, but you get the idea.

 False and null, cast to strings, equals `''`. That's what is happening
 anyway (as in, if you pass an array, we'll go looking for "something-
 Array.php"), so let's be explicit and add a check.

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


More information about the wp-trac mailing list