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

WordPress Trac wp-trac at lists.automattic.com
Mon Dec 15 11:53:56 GMT 2008


#8620: Fatal error with HTTP class
---------------------------+------------------------------------------------
 Reporter:  momo360modena  |       Owner:  anonymous
     Type:  defect         |      Status:  new      
 Priority:  high           |   Milestone:  2.7.1    
Component:  General        |     Version:  2.7      
 Severity:  major          |    Keywords:           
---------------------------+------------------------------------------------
 I have a small error with a personal plugin when i use the new HTTP class.
 {{{
 Fatal error: Cannot use object of type WP_Error as array in /wp-
 includes/http.php on line 1215
 }}}

 I use this code in my plugin:
 {{{
 $reponse = wp_remote_get( $clean_url );
 if( !is_wp_error($response) && $reponse != null ) {
  $code = wp_remote_retrieve_response_code($reponse);
  if ( $code == 200 ) {
   $image_raw = wp_remote_retrieve_body($reponse);
  }
 }
 }}}

 This code is under a foreach loop. (20 items by 20 items)

 I add a var_dump() into the function wp_remote_retrieve_response_code()
 The ouput when i have an error is:

 {{{
 WP_Error::__set_state(array(
    'errors' =>
   array (
     'http_request_failed' =>
     array (
       0 => 'Operation timed out after 5000 milliseconds with 0 bytes
 received',
     ),
   ),
    'error_data' =>
   array (
   ),
 ))
 }}}

 I suggest a patch with this ticket.
 My PHP version : PHP Version 5.2.6-2+b1

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


More information about the wp-trac mailing list