On Wed, 25 Jun 2008, Olivier Hill wrote:

> ohill         Wed Jun 25 12:16:17 2008 UTC
> 
>   Modified files:              (Branch: PHP_5_3)
>     /php-src/ext/standard     string.c 

<snip>

>   Log:
>   New parameter parsing API

The following change introduces a regression:

@@ -4135,24 +4095,23 @@
    Parses GET/POST/COOKIE data and sets global variables */
 PHP_FUNCTION(parse_str)
 {
-       zval **arg;
-       zval **arrayArg;
+       char *arg;
+       zval **arrayArg = NULL;
        zval *sarg;
        char *res = NULL;
-       int argCount;
+       int arglen;
 
-       argCount = ZEND_NUM_ARGS();
-       if (argCount < 1 || argCount > 2 || zend_get_parameters_ex(argCount, 
&arg, &arrayArg) == FAILURE) {
-               WRONG_PARAM_COUNT;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|Z", &arg, 
&arglen, &arrayArg) == FAILURE) {
+               return;
        }
 
-       convert_to_string_ex(arg);
-       sarg = *arg;
-       if (Z_STRVAL_P(sarg) && *Z_STRVAL_P(sarg)) {
-               res = estrndup(Z_STRVAL_P(sarg), Z_STRLEN_P(sarg));
+       if (!arglen) {
+               return;
        }
 
-       if (argCount == 1) {
+       res = estrndup(arg, arglen);
+
+       if (arrayArg == NULL) {
                zval tmp;
 
                if (!EG(active_symbol_table)) {


[EMAIL PROTECTED]:~$ php-5.2dev -r 'parse_str( "", $p ); var_dump( $p );'

array(0) {
}

[EMAIL PROTECTED]:~$ php-5.3dev -r 'parse_str( "", $p ); var_dump( $p );'
NULL

Please fix this - a test file is attached.

regards,
Derick

-- 
HEAD before 5_3!: http://tinyurl.com/6d2esb
http://derickrethans.nl | http://ezcomponents.org | http://xdebug.org
--TEST--
parse_str() with empty query string
--FILE--
<?php
parse_str( "", $p ); var_dump( $p );
?>
--EXPECT--
array(0) {
}
-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to