summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo André dos Santos Lopes <cataphract@php.net>2010-10-27 14:56:51 +0000
committerGustavo André dos Santos Lopes <cataphract@php.net>2010-10-27 14:56:51 +0000
commitda400e7500e236a332b8104b373e60e842bbd63e (patch)
treec1b9ec9f9af32cfc258853ac7d0009202f7b6ff0
parentbe77a48a715e9cd7089334b9506eadc0a4795e9e (diff)
downloadphp-git-da400e7500e236a332b8104b373e60e842bbd63e.tar.gz
- Fixed bug #53180 (post_max_size=0 not disabling the limit when the content
type is application/x-www-form-urlencoded or is not registered with PHP).
-rw-r--r--main/SAPI.c4
-rw-r--r--tests/basic/bug53180.phpt19
2 files changed, 21 insertions, 2 deletions
diff --git a/main/SAPI.c b/main/SAPI.c
index 365f8f6cd9..22be6c2e4d 100644
--- a/main/SAPI.c
+++ b/main/SAPI.c
@@ -194,7 +194,7 @@ SAPI_API SAPI_POST_READER_FUNC(sapi_read_standard_form_data)
int read_bytes;
int allocated_bytes=SAPI_POST_BLOCK_SIZE+1;
- if (SG(request_info).content_length > SG(post_max_size)) {
+ if ((SG(post_max_size) > 0) && (SG(request_info).content_length > SG(post_max_size))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "POST Content-Length of %ld bytes exceeds the limit of %ld bytes",
SG(request_info).content_length, SG(post_max_size));
return;
@@ -207,7 +207,7 @@ SAPI_API SAPI_POST_READER_FUNC(sapi_read_standard_form_data)
break;
}
SG(read_post_bytes) += read_bytes;
- if (SG(read_post_bytes) > SG(post_max_size)) {
+ if ((SG(post_max_size) > 0) && (SG(read_post_bytes) > SG(post_max_size))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Actual POST length does not match Content-Length, and exceeds %ld bytes", SG(post_max_size));
break;
}
diff --git a/tests/basic/bug53180.phpt b/tests/basic/bug53180.phpt
new file mode 100644
index 0000000000..5c2eb76952
--- /dev/null
+++ b/tests/basic/bug53180.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #53180 (post_max_size=0 partly not working)
+--INI--
+post_max_size=0
+--POST--
+email=foo&password=bar&submit=Log+on
+--FILE--
+<?php
+var_dump($_POST);
+?>
+--EXPECT--
+array(3) {
+ ["email"]=>
+ string(3) "foo"
+ ["password"]=>
+ string(3) "bar"
+ ["submit"]=>
+ string(6) "Log on"
+}