]> granicus.if.org Git - php/commitdiff
- Fixed bug #53180 (post_max_size=0 not disabling the limit when the content
authorGustavo André dos Santos Lopes <cataphract@php.net>
Wed, 27 Oct 2010 14:56:51 +0000 (14:56 +0000)
committerGustavo André dos Santos Lopes <cataphract@php.net>
Wed, 27 Oct 2010 14:56:51 +0000 (14:56 +0000)
  type is application/x-www-form-urlencoded or is not registered with PHP).

main/SAPI.c
tests/basic/bug53180.phpt [new file with mode: 0644]

index 365f8f6cd911d509a3bd6b8da1740aabe5557a40..22be6c2e4daddcbdd0c2e89c23a6e01f22987b2c 100644 (file)
@@ -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 (file)
index 0000000..5c2eb76
--- /dev/null
@@ -0,0 +1,19 @@
+--TEST--\r
+Bug #53180 (post_max_size=0 partly not working)\r
+--INI--\r
+post_max_size=0\r
+--POST--\r
+email=foo&password=bar&submit=Log+on\r
+--FILE--\r
+<?php\r
+var_dump($_POST);\r
+?>\r
+--EXPECT--\r
+array(3) {\r
+  ["email"]=>\r
+  string(3) "foo"\r
+  ["password"]=>\r
+  string(3) "bar"\r
+  ["submit"]=>\r
+  string(6) "Log on"\r
+}\r