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

WordPress Trac wp-trac at lists.automattic.com
Sun Jul 4 15:44:46 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:  has-patch needs-testing
--------------------------+-------------------------------------------------

Comment(by mailnew2ster):

 Well, yes, most of these cases will never be noticed... Like nobody will
 download a page with "0", or use a "0" protocol (0://sth/, I guess it's
 possible), and nobody will even notice that one of the cookies doesn't get
 saved, but imo it's a bad style of coding, and these are bugs.

 Also, I don't really understand the logic behind empty("0") returning
 true. It's not empty, it's a string and has a length of one character,
 check strlen("0").

 > During my research...
 There are rfcs, and I think code should be written according to what is
 written there, and not according to your own researches.
 I did not read the rfcs, but php.net suggests 00 is also a posibility:
 http://www.php.net/manual/en/function.http-chunked-decode.php

 > Question: Do you think we are amateurs and don't realize proper string
 comparisons?
 Of cource not :)
 I'm the amateur here, but I still managed to find some bugs quite easily,
 and I present some oppinions and suggestions according to what I think.

 > it would require adding an isset() check.
 I'd prefer adding it. Maybe it's also a matter of coding style...

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


More information about the wp-trac mailing list