[wp-trac] Re: [WordPress Trac] #8620: Fatal error with HTTP class

WordPress Trac wp-trac at lists.automattic.com
Tue Apr 28 11:17:22 GMT 2009


#8620: Fatal error with HTTP class
---------------------------+------------------------------------------------
 Reporter:  momo360modena  |        Owner:  westi   
     Type:  defect (bug)   |       Status:  reopened
 Priority:  high           |    Milestone:  2.8     
Component:  HTTP           |      Version:  2.7     
 Severity:  major          |   Resolution:          
 Keywords:  has-patch      |  
---------------------------+------------------------------------------------

Comment(by hakre):

 Replying to [comment:21 DD32]:
 > You're correct, A valid $response (ie. not WP_Error) should be passed,
 Thats not always the case though. However, isset() does not work as you
 expect:
 >
 > {{{
 > $a = (object) array();
 >
 > isset($a['test']);
 >
 > ( ! ) Fatal error: Cannot use object of type stdClass as array in
 ...\1240904033.php on line ...
 > }}}

 well, that fatal error occurs in that line:

 {{{
 $a = (object) array();
 }}}
 , right? this is not error message created by isset(), it is created by
 the cast.

 > > Infact, the (In [11091]) patch will throw errors/notices/warnings if
 $response['response'] is set and an array but does not contain a key
 called 'message'.
 >
 > Pretty useless there though, The assumption is, That if
 {{{$response['response']}}} is set, Then its a valid HTTP return, The
 return will ALWAYS include the message and code, even if they're blank.

 Well if you even test for having a specific object in here (WP_Error),
 then you won't test for the right array item? That seems a pretty
 ambiguous argumentation to me.


 > And, -1 to the extra complexity of the if statements, They dont gain
 anything, Just more complex code, Theres nothing to be afraid of with
 extra whitespace and 2 if's instead of 1, While the extra if adds an extra
 0.01ms, Its not code thats being called a hundred times a pageload,
 optimizations can be left alone for easier readability.

 I will reduce the complexity sothat it's written more nice.

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


More information about the wp-trac mailing list