SECURITY: rate-limit and prevent blocked users from changing email
[lhc/web/wiklou.git] / includes / http / PhpHttpRequest.php
index d2af8c8..c987c62 100644 (file)
@@ -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