Skip to content

Instantly share code, notes, and snippets.

Created March 14, 2012 19:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/2038870 to your computer and use it in GitHub Desktop.
Save anonymous/2038870 to your computer and use it in GitHub Desktop.
Index: ext/standard/string.c
===================================================================
--- ext/standard/string.c (revision 324248)
+++ ext/standard/string.c (working copy)
@@ -4201,7 +4201,7 @@
}
/* }}} */
-/* {{{ proto void parse_str(string encoded_string [, array result])
+/* {{{ proto void parse_str(string encoded_string [, array result [, int max_vars]])
Parses GET/POST/COOKIE data and sets global variables */
PHP_FUNCTION(parse_str)
{
@@ -4209,13 +4209,19 @@
zval *arrayArg = NULL;
char *res = NULL;
int arglen;
+ long max_vars;
+ long old_max_vars = PG(max_input_vars);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &arg, &arglen, &arrayArg) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|zl", &arg, &arglen, &arrayArg, &max_vars) == FAILURE) {
return;
}
res = estrndup(arg, arglen);
+ if (max_vars != old_max_vars) {
+ PG(max_input_vars) = max_vars;
+ }
+
if (arrayArg == NULL) {
zval tmp;
@@ -4233,6 +4239,10 @@
zval_dtor(arrayArg);
ZVAL_COPY_VALUE(arrayArg, &ret);
}
+
+ if (max_vars != old_max_vars) {
+ PG(max_input_vars) = old_max_vars;
+ }
}
/* }}} */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment