r91463 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91462‎ | r91463 | r91464 >
Date:16:40, 5 July 2011
Author:ialex
Status:ok (Comments)
Tags:
Comment:
Per Brion, fix for r91460: make this a bit more robust
Modified paths:
  • /trunk/phase3/includes/WebResponse.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/WebResponse.php
@@ -87,8 +87,9 @@
8888 */
8989 public function header( $string, $replace = true, $http_response_code = null ) {
9090 $match = array();
91 - if ( preg_match( '~^HTTP/1.\d (\d+)\D*$~', $string, $match ) ) {
92 - $this->code = intval( $match[1] );
 91+ if ( substr( $string, 0, 5 ) == 'HTTP/' ) {
 92+ $parts = explode( ' ', $string, 3 );
 93+ $this->code = intval( $parts[1] );
9394 } else {
9495 list( $key, $val ) = explode( ":", $string, 2 );
9596

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r91460* Don't create a WebRequest obhject in CLI mode but a FauxRequest; avoids som...ialex15:05, 5 July 2011

Comments

#Comment by Brion VIBBER (talk | contribs)   16:42, 5 July 2011

Ahh that's better :D

Status & tagging log