Fixed bug #63447 (max_input_vars doesn't filter variables when mbstring.encoding_translation = On)

This commit is contained in:
Xinchen Hui 2012-11-07 17:05:24 +08:00
parent 0ee5d18f91
commit 7fcbe4d546
5 changed files with 84 additions and 0 deletions

4
NEWS
View File

@ -12,6 +12,10 @@ PHP NEWS
. Fixed bug #63389 (Missing context check on libxml_set_streams_context()
causes memleak). (Laruence)
- Mbstring:
. Fixed bug #63447 (max_input_vars doesn't filter variables when
mbstring.encoding_translation = On). (Laruence)
- MySQL:
. Fixed compilation failure on mixed 32/64 bit systems. (Andrey)

View File

@ -262,6 +262,12 @@ enum mbfl_no_encoding _php_mb_encoding_handler_ex(const php_mb_encoding_handler_
n++;
var = php_strtok_r(NULL, info->separator, &strtok_buf);
}
if (n > (PG(max_input_vars) * 2)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input variables exceeded %ld. To increase the limit change max_input_vars in php.ini.", PG(max_input_vars));
goto out;
}
num = n; /* make sure to process initilized vars only */
/* initialize converter */

View File

@ -0,0 +1,20 @@
--TEST--
Bug #63447 (max_input_vars doesn't filter variables when mbstring.encoding_translation = On)
--SKIPIF--
<?php
extension_loaded('mbstring') or die('skip');
?>
--INI--
max_input_nesting_level=10
max_input_vars=5
mbstring.encoding_translation=1
--POST--
a=1&b=2&c=3&d=4&e=5&f=6
--FILE--
<?php
var_dump($_POST);
?>
--EXPECT--
Warning: Unknown: Input variables exceeded 5. To increase the limit change max_input_vars in php.ini. in Unknown on line 0
array(0) {
}

View File

@ -0,0 +1,20 @@
--TEST--
Bug #63447 (max_input_vars doesn't filter variables when mbstring.encoding_translation = On)
--SKIPIF--
<?php
extension_loaded('mbstring') or die('skip');
?>
--INI--
max_input_nesting_level=10
max_input_vars=4
mbstring.encoding_translation=1
--POST--
a=1&b=2&c=3&d=4&e=5
--FILE--
<?php
var_dump($_POST);
?>
--EXPECT--
Warning: Unknown: Input variables exceeded 4. To increase the limit change max_input_vars in php.ini. in Unknown on line 0
array(0) {
}

View File

@ -0,0 +1,34 @@
--TEST--
Bug #63447 (max_input_vars doesn't filter variables when mbstring.encoding_translation = On)
--SKIPIF--
<?php
extension_loaded('mbstring') or die('skip');
?>
--INI--
max_input_nesting_level=5
max_input_vars=100
mbstring.encoding_translation=1
--POST--
a=1&b[][][]=2&c[][][][][][]=7
--FILE--
<?php
print_r($_POST);
?>
--EXPECT--
Array
(
[a] => 1
[b] => Array
(
[0] => Array
(
[0] => Array
(
[0] => 2
)
)
)
)