ApiQueryBase: Fix addWhereFld for PHP 7.2
[lhc/web/wiklou.git] / includes / WebRequestUpload.php
index e743d9d..916a10c 100644 (file)
@@ -102,7 +102,7 @@ class WebRequestUpload {
 
        /**
         * Return the upload error. See link for explanation
-        * http://www.php.net/manual/en/features.file-upload.errors.php
+        * https://secure.php.net/manual/en/features.file-upload.errors.php
         *
         * @return int One of the UPLOAD_ constants, 0 if non-existent
         */
@@ -126,8 +126,13 @@ class WebRequestUpload {
                        return true;
                }
 
-               $contentLength = $this->request->getHeader( 'CONTENT_LENGTH' );
-               if ( $contentLength > wfShorthandToInteger( ini_get( 'post_max_size' ) ) ) {
+               $contentLength = $this->request->getHeader( 'Content-Length' );
+               $maxPostSize = wfShorthandToInteger(
+                       ini_get( 'post_max_size' ) ?: ini_get( 'hhvm.server.max_post_size' ),
+                       0
+               );
+
+               if ( $maxPostSize && $contentLength > $maxPostSize ) {
                        # post_max_size is exceeded
                        return true;
                }