From 8da01fd402aa1f22b61d3471df043afe3fc9f3da Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Fri, 27 Jan 2017 22:47:15 +0000 Subject: [PATCH] Support unlimited post size correctly (#17607) --- .../Foundation/Http/Middleware/ValidatePostSize.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php b/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php index 475bfac00415..d952b0c044b1 100644 --- a/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php +++ b/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php @@ -18,7 +18,9 @@ class ValidatePostSize */ public function handle($request, Closure $next) { - if ($request->server('CONTENT_LENGTH') > $this->getPostMaxSize()) { + $max = $this->getPostMaxSize(); + + if ($max > 0 && $request->server('CONTENT_LENGTH') > $max) { throw new PostTooLargeException; }