[wp-trac] [WordPress Trac] #16885: Warning emited in Header parsing when server does not specify a response "Message"

WordPress Trac wp-trac at lists.automattic.com
Fri Mar 18 12:46:37 UTC 2011


#16885: Warning emited in Header parsing when server does not specify a response
"Message"
------------------------------+------------------------------
 Reporter:  dd32              |       Owner:
     Type:  defect (bug)      |      Status:  new
 Priority:  normal            |   Milestone:  Awaiting Review
Component:  Warnings/Notices  |     Version:  3.1
 Severity:  normal            |  Resolution:
 Keywords:                    |
------------------------------+------------------------------
Description changed by dd32:

Old description:

> As reported in #16855, the HTTP API class can emit a warning in the case
> that a server does not specify the response message.
>
> One example of a URL which causes this is:
> http://wallpapers.protonet.ru/section/foto/O/ which has a response of:
> {{{
> HTTP/1.1 404
> Server: nginx/0.6.32
> }}}
>
> causing:
> {{{
> Undefined offset: 2 in \wp-includes\class-http.php on line <i>442</i>
> }}}
>
> Code in question: [http://core.trac.wordpress.org/browser/trunk/wp-
> includes/class-http.php#L442 list( , $response['code'],
> $response['message']) = explode(' ', $tempheader, 3);]
>
> One potential patch would be:
> {{{
> $p = explode(' ', $tempheader, 3);
> array_shift($p);
> $response['code'] = array_shift($p);
> $response['message'] = array_shift($p);
> }}}

New description:

 As reported in #16855 by cogmios, the HTTP API class can emit a warning in
 the case that a server does not specify the response message.

 One example of a URL which causes this is:
 http://wallpapers.protonet.ru/section/foto/O/ which has a response of:
 {{{
 HTTP/1.1 404
 Server: nginx/0.6.32
 }}}

 causing:
 {{{
 Undefined offset: 2 in \wp-includes\class-http.php on line <i>442</i>
 }}}

 Code in question: [http://core.trac.wordpress.org/browser/trunk/wp-
 includes/class-http.php#L442 list( , $response['code'],
 $response['message']) = explode(' ', $tempheader, 3);]

 One potential patch would be:
 {{{
 $p = explode(' ', $tempheader, 3);
 array_shift($p);
 $response['code'] = array_shift($p);
 $response['message'] = array_shift($p);
 }}}

--

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


More information about the wp-trac mailing list