X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fhttp%2FPhpHttpRequest.php;h=c987c62b1cc595be7d6902fff0c19dc92d2c3538;hb=18c2d20c54f9851af639cb24603493ca197baaa8;hp=30ab181e1d26864c9090d59399c20ac5d801fcb7;hpb=9c185ca85c3c58f96e866c9347c2b7f031ddb289;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/http/PhpHttpRequest.php b/includes/http/PhpHttpRequest.php index 30ab181e1d..c987c62b1c 100644 --- a/includes/http/PhpHttpRequest.php +++ b/includes/http/PhpHttpRequest.php @@ -22,6 +22,17 @@ class PhpHttpRequest extends MWHttpRequest { private $fopenErrors = []; + public function __construct() { + if ( !wfIniGetBool( 'allow_url_fopen' ) ) { + throw new RuntimeException( __METHOD__ . ': allow_url_fopen needs to be enabled for ' . + 'pure PHP http requests to work. If possible, curl should be used instead. See ' . + 'https://www.php.net/curl.' + ); + } + + parent::__construct( ...func_get_args() ); + } + /** * @param string $url * @return string @@ -217,7 +228,7 @@ class PhpHttpRequest extends MWHttpRequest { break; } - if ( strlen( $buf ) ) { + if ( $buf !== '' ) { call_user_func( $this->callback, $fh, $buf ); } }