[wp-trac] [WordPress Trac] #12212: post__in and other array_key can't manage empty array properly

WordPress Trac wp-trac at lists.automattic.com
Mon Feb 15 20:03:32 UTC 2010


#12212: post__in and other array_key can't manage empty array properly
--------------------------+-------------------------------------------------
 Reporter:  lifeless85    |       Owner:  ryan       
     Type:  defect (bug)  |      Status:  new        
 Priority:  normal        |   Milestone:  3.0        
Component:  Query         |     Version:  2.9.1      
 Severity:  normal        |    Keywords:  needs-patch
--------------------------+-------------------------------------------------

Comment(by lifeless85):

 P.s. Setting a variable to null in PHP is equivalent to having it
 undeclared ...
 http://it.php.net/manual/en/language.types.null.php#language.types.null.syntax
 and setting it to false could lead to other problems, maybe not here where
 we expect arrays.

 But if this practice hopefully get extended to others query vars, setting
 a variable to false where we expect for example a boolean, is a very bad
 practice, we should use isset($var) instead of a simple if($var) to
 distinguish if it's false because it's undefined or it's false because we
 wanted it to be false ...

 So i exclude false would be a good idea, and null is pointless ...

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


More information about the wp-trac mailing list