Re: Error when POST / upload limits are exceeded
| From: | Rasmus Lerdorf | Date: | Tue, 01 Oct 2019 12:22:04 +0000 |
| Subject: | Re: Error when POST / upload limits are exceeded | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-107355@lists.php.net to get a copy of this message | ||
On Tue, Oct 1, 2019 at 1:00 AM Benjamin Morel <benjamin.morel@gmail.com>
wrote:
> Hi internals,
>
> One thing that always bugged me is how PHP silently ignores data that
> exceeds the limits defined in php.ini.
>
> For example, posting a form exceeding post_max_size results in empty $_POST
> and $_FILES, with no error message whatsoever. This has bugged a few more
> people than just myself, if I believe this StackOverflow question
> <https://stackoverflow.com/q/2133652/759866> with 37k
> views.
>
> Another example is max_file_uploads: if I upload more files that the
> configured value, the subsequent files are silently ignored, and only the
> first n files appear in $_FILES.
>
> I'd like to work on an RFC to make all these errors in PHP 8 (ideally with
> a way to catch the error, but I'm not sure how to do that), but would love
> to get some feedback/ideas before venturing in an RFC.
>
We have https://www.php.net/manual/en/features.file-upload.errors.php
but
in general this is not so easy to make more convenient because this runs
before your PHP code starts to run, so it is not like you can stick it in a
try/catch.
-Rasmus