From: Alexandre Emsenhuber Date: Tue, 5 Jul 2011 16:40:12 +0000 (+0000) Subject: Per Brion, fix for r91460: make this a bit more robust X-Git-Tag: 1.31.0-rc.0~29060 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=303eb519247d7d5ca95dc3c52294743f58d0a6ec;p=lhc%2Fweb%2Fwiklou.git Per Brion, fix for r91460: make this a bit more robust --- 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 );