[wp-trac] [WordPress Trac] #14184: empty() and "0" in class-http.php

WordPress Trac wp-trac at lists.automattic.com
Sat Jul 3 18:18:31 UTC 2010


#14184: empty() and "0" in class-http.php
--------------------------+-------------------------------------------------
 Reporter:  mailnew2ster  |       Owner:                         
     Type:  defect (bug)  |      Status:  new                    
 Priority:  normal        |   Milestone:  Awaiting Review        
Component:  HTTP          |     Version:                         
 Severity:  normal        |    Keywords:  empty 0 zero http class
--------------------------+-------------------------------------------------
 Hello!

 I just saw you have a nice implementation of an http class, but while
 looking at it, I've noticed a minor bug:

 You use the empty() function to check whether strings are empty, for
 example in the WP_Http_Cookie class. This is not a correct thing to do,
 because empty() returns true also for a "0" string, which is not really
 empty. That way, a cookie like that: "balloons=0", will just be skipped!

 You'd better use a ($string == "") comperation.

 Cheers :)

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14184>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list