diff options
Diffstat (limited to 'ext/standard/string.c')
-rw-r--r-- | ext/standard/string.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/ext/standard/string.c b/ext/standard/string.c index 347839b3f3..9ab31ba57f 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -3857,7 +3857,6 @@ PHP_FUNCTION(parse_str) zval *sarg; char *res = NULL; int argCount; - int old_rg; argCount = ZEND_NUM_ARGS(); if (argCount < 1 || argCount > 2 || zend_get_parameters_ex(argCount, &arg, &arrayArg) == FAILURE) { @@ -3870,19 +3869,18 @@ PHP_FUNCTION(parse_str) res = estrndup(Z_STRVAL_P(sarg), Z_STRLEN_P(sarg)); } - old_rg = PG(register_globals); if (argCount == 1) { - PG(register_globals) = 1; - sapi_module.treat_data(PARSE_STRING, res, NULL TSRMLS_CC); + zval tmp; + Z_ARRVAL(tmp) = EG(active_symbol_table); + + sapi_module.treat_data(PARSE_STRING, res, &tmp TSRMLS_CC); } else { - PG(register_globals) = 0; /* Clear out the array that was passed in. */ zval_dtor(*arrayArg); array_init(*arrayArg); sapi_module.treat_data(PARSE_STRING, res, *arrayArg TSRMLS_CC); } - PG(register_globals) = old_rg; } /* }}} */ @@ -4883,6 +4881,10 @@ PHP_FUNCTION(substr_compare) RETURN_FALSE; } + if (offset < 0) { + offset = s1_len + offset; + } + cmp_len = (uint) (len ? len : MAX(s2_len, (s1_len - offset))); if (!cs) { |