From: rudolf at softwares dot ch
Operating system: Windows XP Pro
PHP version: 4.3.9
PHP Bug Type: Documentation problem
Bug description: Undefined behavior when uploaded file > post_max_size
Description:
------------
I'm not sure if this is a documentation omission and/or a PHP bug:
I want to limit the size of files that can be uploaded to 8MB. I have set
upload_max_filesize to 8MB and post_max_size to 10MB. memory_limit is not
enabled.
When I upload a 9MB file, then $_FILES['myfile']['error'] is 1, as
documented. When I upload a 14MB file, PHP writes nothing to stdout and
writes the following to syslog:
PHP Warning: POST Content-Length of 14171720 bytes exceeds the limit of
10485760 bytes in Unknown on line 0
The documentation doesn't say how PHP reacts when it uploads a file larger
than post_max_size, but I would assume that it should not "give up," which
is the behavior I'm experiencing.
Reproduce code:
---------------
<html>
<body>
<?php
if ( $_POST['but_submit'] ) {
printf("Got the submit!! error (%d) size (%d)",
$_FILES['the_file']['error'],
$_FILES['the_file']['size']);
}
?>
<form method="post" action="fileupload.php"
enctype="multipart/form-data">
<table class="form" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>File</td>
<td>
<input type="file" name="the_file" />
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="but_submit" value="Submit" />
</td>
</tr>
</table>
</form>
</body>
</html>
Expected result:
----------------
Unknown, since the documentation doesn't describe how PHP responds when
the size of the uploaded file is greater than post_max_size.
Actual result:
--------------
A PHP warning written to syslog, and nothing written to stdout. See
description above.
--
Edit bug report at http://bugs.php.net/?id=31775&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31775&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=31775&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=31775&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31775&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31775&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31775&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31775&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31775&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31775&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31775&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=31775&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=31775&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31775&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31775&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31775&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31775&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31775&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31775&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=31775&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31775&r=mysqlcfg