X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=blobdiff_plain;f=includes%2Fhttp%2FPhpHttpRequest.php;h=d8a9949d2f42c9d263a311fdf1e2f4ed65c43935;hb=1531659d252cd85c6f625a79c7e1f6e5f847fe3f;hp=f422ff780a57b418a6e9aef3629b5cfb34267776;hpb=b5d93579cc689629c34b61695d07a938f4a28ce4;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/http/PhpHttpRequest.php b/includes/http/PhpHttpRequest.php index f422ff780a..d8a9949d2f 100644 --- a/includes/http/PhpHttpRequest.php +++ b/includes/http/PhpHttpRequest.php @@ -17,7 +17,6 @@ * * @file */ -use MediaWiki\Logger\LoggerFactory; class PhpHttpRequest extends MWHttpRequest { @@ -88,6 +87,7 @@ class PhpHttpRequest extends MWHttpRequest { * is completely useless (something like "fopen: failed to open stream") * so normal methods of handling errors programmatically * like get_last_error() don't work. + * @internal */ public function errorHandler( $errno, $errstr ) { $n = count( $this->fopenErrors ) + 1; @@ -95,8 +95,7 @@ class PhpHttpRequest extends MWHttpRequest { } public function execute() { - - parent::execute(); + $this->prepare(); if ( is_array( $this->postData ) ) { $this->postData = wfArrayToCgi( $this->postData ); @@ -212,7 +211,7 @@ class PhpHttpRequest extends MWHttpRequest { $url = $this->getResponseHeader( "Location" ); if ( !Http::isValidURI( $url ) ) { - wfDebug( __METHOD__ . ": insecure redirection\n" ); + $this->logger->debug( __METHOD__ . ": insecure redirection\n" ); break; } } while ( true ); @@ -224,16 +223,16 @@ class PhpHttpRequest extends MWHttpRequest { if ( $fh === false ) { if ( $this->fopenErrors ) { - LoggerFactory::getInstance( 'http' )->warning( __CLASS__ + $this->logger->warning( __CLASS__ . ': error opening connection: {errstr1}', $this->fopenErrors ); } $this->status->fatal( 'http-request-error' ); - return $this->status; + return Status::wrap( $this->status ); // TODO B/C; move this to callers } if ( $result['timed_out'] ) { $this->status->fatal( 'http-timed-out', $this->url ); - return $this->status; + return Status::wrap( $this->status ); // TODO B/C; move this to callers } // If everything went OK, or we received some error code @@ -254,6 +253,6 @@ class PhpHttpRequest extends MWHttpRequest { } fclose( $fh ); - return $this->status; + return Status::wrap( $this->status ); // TODO B/C; move this to callers } }