Re: GET/POST array handling (was [PATCH] Deprecate use of stdio)

From: Date: Sun, 04 May 2003 19:23:04 +0000
Subject: Re: GET/POST array handling (was [PATCH] Deprecate use of stdio)
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-1232@lists.php.net to get a copy of this message
On May 4, 2003 02:28 pm, you wrote: > On Sun, 4 May 2003, Ilia A. wrote: > > On May 4, 2003 02:13 pm, Rasmus Lerdorf wrote: > > > > Now, if we are dealing with arrays another questions comes to mind, > > > > if I have $_POST['abc']['xyz'] = 1 & > > > > $_POST['abc']['xyz] = 2 and I > > > > am already considering merging arrays, why shouldn't my > > > > $_REQUEST['abc']['xyz'] by array(1,2) ? > > > > > > It should, but right now that doesn't happen. > > > > Would that not present a BC break by itself as well? > > Well, before your patch $_REQUEST worked correctly actually. Here is a small patch, that makes $_REQUEST work properly once more. I am not certain about the performance implications of such a patch, but as far as functionality goes it does seem to do the trick. Ilia

Index: main/main.c =================================================================== RCS file: /repository/php4/main/main.c,v retrieving revision 1.512.2.25 diff -u -3 -p -r1.512.2.25 main.c --- main/main.c 28 Apr 2003 21:00:41 -0000 1.512.2.25 +++ main/main.c 4 May 2003 19:14:04 -0000 @@ -1436,15 +1436,15 @@ static int php_hash_environment(TSRMLS_D switch (*p) { case 'g': case 'G': - zend_hash_merge(Z_ARRVAL_P(form_variables), Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_GET]), (void (*)(void *pData)) zval_add_ref, NULL, sizeof(zval *), 1); + php_array_merge(Z_ARRVAL_P(form_variables), Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_GET]), 1 TSRMLS_CC); break; case 'p': case 'P': - zend_hash_merge(Z_ARRVAL_P(form_variables), Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_POST]), (void (*)(void *pData)) zval_add_ref, NULL, sizeof(zval *), 1); + php_array_merge(Z_ARRVAL_P(form_variables), Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_POST]), 1 TSRMLS_CC); break; case 'c': case 'C': - zend_hash_merge(Z_ARRVAL_P(form_variables), Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_COOKIE]), (void (*)(void *pData)) zval_add_ref, NULL, sizeof(zval *), 1); + php_array_merge(Z_ARRVAL_P(form_variables), Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_COOKIE]), 1 TSRMLS_CC); break; } }
« previous php.internals (#1232) next »