From 303eb519247d7d5ca95dc3c52294743f58d0a6ec Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Tue, 5 Jul 2011 16:40:12 +0000 Subject: [PATCH] Per Brion, fix for r91460: make this a bit more robust --- includes/WebResponse.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/WebResponse.php b/includes/WebResponse.php index a2d257c13a..6d443425c9 100644 --- a/includes/WebResponse.php +++ b/includes/WebResponse.php @@ -87,8 +87,9 @@ class FauxResponse extends WebResponse { */ public function header( $string, $replace = true, $http_response_code = null ) { $match = array(); - if ( preg_match( '~^HTTP/1.\d (\d+)\D*$~', $string, $match ) ) { - $this->code = intval( $match[1] ); + if ( substr( $string, 0, 5 ) == 'HTTP/' ) { + $parts = explode( ' ', $string, 3 ); + $this->code = intval( $parts[1] ); } else { list( $key, $val ) = explode( ":", $string, 2 ); -- 2.20.1