Decouple DEBUG_FILE_UPLOAD from ZEND_DEBUG

Enabling ZEND_DEBUG should not result in intrusive program
behavior changes.
This commit is contained in:
Nikita Popov 2016-08-19 00:12:27 +02:00
parent cf40f999ba
commit 37b0dcc8e0
17 changed files with 4 additions and 135 deletions

View File

@ -40,7 +40,9 @@
# define HAVE_ATOLL 1
#endif
#define DEBUG_FILE_UPLOAD ZEND_DEBUG
#ifndef DEBUG_FILE_UPLOAD
# define DEBUG_FILE_UPLOAD 0
#endif
static int dummy_encoding_translation(void)
{

View File

@ -2,8 +2,6 @@
rfc1867 anonymous upload
--INI--
file_uploads=1
error_reporting=E_ALL&~E_NOTICE
comment=debug builds show some additional E_NOTICE errors
upload_max_filesize=1024
max_file_uploads=10
--POST_RAW--

View File

@ -2,8 +2,6 @@
rfc1867 array upload
--INI--
file_uploads=1
error_reporting=E_ALL&~E_NOTICE
comment=debug builds show some additional E_NOTICE errors
upload_max_filesize=1024
max_file_uploads=10
--POST_RAW--

View File

@ -2,8 +2,6 @@
rfc1867 boundary 1
--INI--
post_max_size=1024
error_reporting=E_ALL&~E_NOTICE
comment=debug builds show some additional E_NOTICE errors
--POST_RAW--
Content-Type: multipart/form-data; boundary="------------------------------------foobar"
--------------------------------------foobar

View File

@ -2,8 +2,6 @@
rfc1867 boundary 2
--INI--
post_max_size=1024
error_reporting=E_ALL&~E_NOTICE
comment=debug builds show some additional E_NOTICE errors
--POST_RAW--
Content-Type: multipart/form-data; boundary=------------------------------------foo, bar
--------------------------------------foo

View File

@ -2,8 +2,6 @@
rfc1867 empty upload
--INI--
file_uploads=1
error_reporting=E_ALL&~E_NOTICE
comment=debug builds show some additional E_NOTICE errors
upload_max_filesize=1024
max_file_uploads=10
--POST_RAW--

View File

@ -2,8 +2,6 @@
rfc1867 file_upload disabled
--INI--
file_uploads=0
error_reporting=E_ALL&~E_NOTICE
comment=debug builds show some additional E_NOTICE errors
--POST_RAW--
Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737
-----------------------------20896060251896012921717172737

View File

@ -2,8 +2,6 @@
rfc1867 garbled mime headers
--INI--
file_uploads=1
error_reporting=E_ALL&~E_NOTICE
comment=debug builds show some additional E_NOTICE errors
upload_max_filesize=1024
--POST_RAW--
Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737

View File

@ -2,8 +2,6 @@
rfc1867 invalid boundary
--INI--
post_max_size=1024
error_reporting=E_ALL&~E_NOTICE
comment=debug builds show some additional E_NOTICE errors
--POST_RAW--
Content-Type: multipart/form-data; boundary="foobar
-----------------------------20896060251896012921717172737

View File

@ -2,8 +2,6 @@
rfc1867 malicious input
--INI--
file_uploads=1
error_reporting=E_ALL&~E_NOTICE
comment=debug builds show some additional E_NOTICE errors
upload_max_filesize=1024
--POST_RAW--
Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737

View File

@ -2,8 +2,6 @@
rfc1867 MAX_FILE_SIZE
--INI--
file_uploads=1
error_reporting=E_ALL&~E_NOTICE
comment=debug builds show some additional E_NOTICE errors
upload_max_filesize=1024
max_file_uploads=10
--POST_RAW--

View File

@ -1,10 +1,7 @@
--TEST--
rfc1867 max_file_uploads - empty files shouldn't count (non-debug version)
--SKIPIF--
<?php if(function_exists("leak")) print "skip only for non-debug builds"; ?>
rfc1867 max_file_uploads - empty files shouldn't count
--INI--
file_uploads=1
error_reporting=E_ALL
max_file_uploads=2
--POST_RAW--
Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737

View File

@ -1,102 +0,0 @@
--TEST--
rfc1867 max_file_uploads - empty files shouldn't count (debug version)
--SKIPIF--
<?php if(!function_exists("leak")) print "skip only for debug builds"; ?>
--INI--
file_uploads=1
error_reporting=E_ALL
max_file_uploads=1
--POST_RAW--
Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737
-----------------------------20896060251896012921717172737
Content-Disposition: form-data; name="file2"; filename=""
Content-Type: text/plain-file
-----------------------------20896060251896012921717172737
Content-Disposition: form-data; name="file3"; filename=""
Content-Type: text/plain-file
33
-----------------------------20896060251896012921717172737
Content-Disposition: form-data; name="file4"; filename="file4.txt"
Content-Type: text/plain-file
-----------------------------20896060251896012921717172737
Content-Disposition: form-data; name="file1"; filename="file1.txt"
Content-Type: text/plain-file
1
-----------------------------20896060251896012921717172737--
--FILE--
<?php
var_dump($_FILES);
var_dump($_POST);
if (is_uploaded_file($_FILES["file1"]["tmp_name"])) {
var_dump(file_get_contents($_FILES["file1"]["tmp_name"]));
}
?>
--EXPECTF--
Notice: No file uploaded in Unknown on line 0
Notice: No file uploaded in Unknown on line 0
Warning: Uploaded file size 0 - file [file4=file4.txt] not saved in Unknown on line 0
array(4) {
["file2"]=>
array(5) {
["name"]=>
string(0) ""
["type"]=>
string(0) ""
["tmp_name"]=>
string(0) ""
["error"]=>
int(4)
["size"]=>
int(0)
}
["file3"]=>
array(5) {
["name"]=>
string(0) ""
["type"]=>
string(0) ""
["tmp_name"]=>
string(0) ""
["error"]=>
int(4)
["size"]=>
int(0)
}
["file4"]=>
array(5) {
["name"]=>
string(9) "file4.txt"
["type"]=>
string(0) ""
["tmp_name"]=>
string(0) ""
["error"]=>
int(5)
["size"]=>
int(0)
}
["file1"]=>
array(5) {
["name"]=>
string(9) "file1.txt"
["type"]=>
string(15) "text/plain-file"
["tmp_name"]=>
string(%d) "%s"
["error"]=>
int(0)
["size"]=>
int(1)
}
}
array(0) {
}
string(1) "1"

View File

@ -2,8 +2,6 @@
rfc1867 missing boundary
--INI--
post_max_size=1024
error_reporting=E_ALL&~E_NOTICE
comment=debug builds show some additional E_NOTICE errors
--POST_RAW--
Content-Type: multipart/form-data
-----------------------------20896060251896012921717172737

View File

@ -2,8 +2,6 @@
rfc1867 missing boundary 2
--INI--
file_uploads=1
error_reporting=E_ALL&~E_NOTICE
comment=debug builds show some additional E_NOTICE errors
upload_max_filesize=1024
--POST_RAW--
Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737

View File

@ -2,8 +2,6 @@
rfc1867 post_max_filesize
--INI--
file_uploads=1
error_reporting=E_ALL&~E_NOTICE
comment=debug builds show some additional E_NOTICE errors
upload_max_filesize=1
max_file_uploads=10
--POST_RAW--

View File

@ -2,8 +2,6 @@
rfc1867 post_max_size
--INI--
post_max_size=1
error_reporting=E_ALL&~E_NOTICE
comment=debug builds show some additional E_NOTICE errors
--POST_RAW--
Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737
-----------------------------20896060251896012921717172737