[PHP-CVS] cvs: php4 /main php_variables.c
iliaa Mon Jun 16 15:24:56 2003 EDT Modified files: /php4/main php_variables.c Log: Fixed bug #24208 Index: php4/main/php_variables.c diff -u php4/main/php_variables.c:1.63 php4/main/php_variables.c:1.64 --- php4/main/php_variables.c:1.63 Sat Jun 14 11:08:27 2003 +++ php4/main/php_variables.c Mon Jun 16 15:24:56 2003 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: php_variables.c,v 1.63 2003/06/14 15:08:27 iliaa Exp $ */ +/* $Id: php_variables.c,v 1.64 2003/06/16 19:24:56 iliaa Exp $ */ #include stdio.h #include php.h @@ -75,6 +75,8 @@ if (track_vars_array) { symtable1 = Z_ARRVAL_P(track_vars_array); + } else if (PG(register_globals)) { + symtable1 = EG(active_symbol_table); } if (!symtable1) { /* Nothing to do */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /main php_variables.c
zeevSun Jun 8 11:30:34 2003 EDT Modified files: /php4/main php_variables.c Log: Make $_FILES auto global (bug #23680) Index: php4/main/php_variables.c diff -u php4/main/php_variables.c:1.60 php4/main/php_variables.c:1.61 --- php4/main/php_variables.c:1.60 Sat Mar 29 20:06:54 2003 +++ php4/main/php_variables.c Sun Jun 8 11:30:33 2003 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: php_variables.c,v 1.60 2003/03/30 01:06:54 shane Exp $ */ +/* $Id: php_variables.c,v 1.61 2003/06/08 15:30:33 zeev Exp $ */ #include stdio.h #include php.h @@ -725,6 +725,7 @@ zend_register_auto_global(_SERVER, sizeof(_SERVER)-1, cb?php_auto_globals_create_server:NULL TSRMLS_CC); zend_register_auto_global(_ENV, sizeof(_ENV)-1, cb?php_auto_globals_create_env:NULL TSRMLS_CC); zend_register_auto_global(_REQUEST, sizeof(_REQUEST)-1, cb?php_auto_globals_create_request:NULL TSRMLS_CC); + zend_register_auto_global(_FILES, sizeof(_FILES)-1, NULL TSRMLS_CC); } /* -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /main php_variables.c
moriyoshi Thu Mar 27 16:13:47 2003 EDT Modified files: /php4/main php_variables.c Log: Improved php_import_environment_variables: avoid emalloc()ing in most cases Index: php4/main/php_variables.c diff -u php4/main/php_variables.c:1.57 php4/main/php_variables.c:1.58 --- php4/main/php_variables.c:1.57 Tue Mar 25 03:07:12 2003 +++ php4/main/php_variables.c Thu Mar 27 16:13:47 2003 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: php_variables.c,v 1.57 2003/03/25 08:07:12 sebastian Exp $ */ +/* $Id: php_variables.c,v 1.58 2003/03/27 21:13:47 moriyoshi Exp $ */ #include stdio.h #include php.h @@ -344,7 +344,11 @@ void _php_import_environment_variables(zval *array_ptr TSRMLS_DC) { - char **env, *p, *t; + char buf[128]; + char **env, *p, *t = buf; + size_t alloc_size = sizeof(buf); + unsigned int nlen; /* ptrdiff_t is not portable */ + /* turn off magic_quotes while importing environment variables */ int magic_quotes_gpc = PG(magic_quotes_gpc); PG(magic_quotes_gpc) = 0; @@ -354,8 +358,16 @@ if (!p) { /* malformed entry? */ continue; } - t = estrndup(*env, p - *env); + nlen = p - *env; + if (nlen = alloc_size) { + alloc_size = nlen + 64; + t = (t == buf ? emalloc(alloc_size): erealloc(t, alloc_size)); + } + memcpy(t, *env, nlen); + t[nlen] = '\0'; php_register_variable(t, p+1, array_ptr TSRMLS_CC); + } + if (t != buf t != NULL) { efree(t); } PG(magic_quotes_gpc) = magic_quotes_gpc; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /main php_variables.c
iliaa Mon Mar 3 14:37:09 2003 EDT Modified files: /php4/main php_variables.c Log: Fixed compiler warnings. Index: php4/main/php_variables.c diff -u php4/main/php_variables.c:1.54 php4/main/php_variables.c:1.55 --- php4/main/php_variables.c:1.54 Sun Mar 2 10:41:12 2003 +++ php4/main/php_variables.c Mon Mar 3 14:37:09 2003 @@ -17,15 +17,17 @@ +--+ */ -/* $Id: php_variables.c,v 1.54 2003/03/02 15:41:12 zeev Exp $ */ +/* $Id: php_variables.c,v 1.55 2003/03/03 19:37:09 iliaa Exp $ */ #include stdio.h #include php.h #include ext/standard/php_standard.h +#include ext/standard/credits.h #include php_variables.h #include php_globals.h #include php_content_types.h #include SAPI.h +#include php_logos.h #include zend_globals.h -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /main php_variables.c
zeevSun Mar 2 10:41:12 2003 EDT Modified files: /php4/main php_variables.c Log: Fix old variable names Index: php4/main/php_variables.c diff -u php4/main/php_variables.c:1.53 php4/main/php_variables.c:1.54 --- php4/main/php_variables.c:1.53 Sun Mar 2 08:35:01 2003 +++ php4/main/php_variables.c Sun Mar 2 10:41:12 2003 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: php_variables.c,v 1.53 2003/03/02 13:35:01 zeev Exp $ */ +/* $Id: php_variables.c,v 1.54 2003/03/02 15:41:12 zeev Exp $ */ #include stdio.h #include php.h @@ -512,12 +512,12 @@ uint long_name_len; zend_bool jit_initialization; } auto_global_records[] = { - { _POST, sizeof(_POST), HTTP_POST_GLOBALS, sizeof(HTTP_POST_GLOBALS), 0 }, - { _GET, sizeof(_GET), HTTP_GET_GLOBALS, sizeof(HTTP_GET_GLOBALS), 0 }, - { _COOKIE, sizeof(_COOKIE), HTTP_COOKIE_GLOBALS, sizeof(HTTP_COOKIE_GLOBALS), 0 }, - { _SERVER, sizeof(_SERVER), HTTP_SERVER_GLOBALS, sizeof(HTTP_SERVER_GLOBALS), 1 }, - { _ENV, sizeof(_ENV), HTTP_ENV_GLOBALS, sizeof(HTTP_ENV_GLOBALS), 1 }, - { _FILES, sizeof(_FILES), HTTP_FILES_GLOBALS, sizeof(HTTP_FILES_GLOBALS), 0 }, + { _POST, sizeof(_POST), HTTP_POST_VARS, sizeof(HTTP_POST_VARS), 0 }, + { _GET, sizeof(_GET), HTTP_GET_VARS, sizeof(HTTP_GET_VARS), 0 }, + { _COOKIE, sizeof(_COOKIE), HTTP_COOKIE_VARS, sizeof(HTTP_COOKIE_VARS), 0 }, + { _SERVER, sizeof(_SERVER), HTTP_SERVER_VARS, sizeof(HTTP_SERVER_VARS), 1 }, + { _ENV, sizeof(_ENV), HTTP_ENV_VARS, sizeof(HTTP_ENV_VARS), 1 }, + { _FILES, sizeof(_FILES), HTTP_POST_FILES, sizeof(HTTP_POST_FILES), 0 }, }; size_t num_track_vars = sizeof(auto_global_records)/sizeof(struct auto_global_record); size_t i; @@ -632,7 +632,7 @@ PG(http_globals)[TRACK_VARS_SERVER]-refcount++; if (PG(register_long_arrays)) { - zend_hash_update(EG(symbol_table), HTTP_SERVER_GLOBALS, sizeof(HTTP_SERVER_GLOBALS), PG(http_globals)[TRACK_VARS_SERVER], sizeof(zval *), NULL); + zend_hash_update(EG(symbol_table), HTTP_SERVER_VARS, sizeof(HTTP_SERVER_VARS), PG(http_globals)[TRACK_VARS_SERVER], sizeof(zval *), NULL); PG(http_globals)[TRACK_VARS_SERVER]-refcount++; } @@ -651,7 +651,7 @@ PG(http_globals)[TRACK_VARS_ENV]-refcount++; if (PG(register_long_arrays)) { - zend_hash_update(EG(symbol_table), HTTP_ENV_GLOBALS, sizeof(HTTP_ENV_GLOBALS), PG(http_globals)[TRACK_VARS_ENV], sizeof(zval *), NULL); + zend_hash_update(EG(symbol_table), HTTP_ENV_VARS, sizeof(HTTP_ENV_VARS), PG(http_globals)[TRACK_VARS_ENV], sizeof(zval *), NULL); PG(http_globals)[TRACK_VARS_ENV]-refcount++; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /main php_variables.c rfc1867.c
iliaa Sun Dec 29 16:02:17 2002 EDT Modified files: /php4/main php_variables.c rfc1867.c Log: Fixed bug #21149 (fixed handling of unterminated '['). Index: php4/main/php_variables.c diff -u php4/main/php_variables.c:1.46 php4/main/php_variables.c:1.47 --- php4/main/php_variables.c:1.46 Sat Dec 7 11:05:27 2002 +++ php4/main/php_variables.c Sun Dec 29 16:02:17 2002 @@ -16,7 +16,7 @@ | Zeev Suraski [EMAIL PROTECTED]| +--+ */ -/* $Id: php_variables.c,v 1.46 2002/12/07 16:05:27 iliaa Exp $ */ +/* $Id: php_variables.c,v 1.47 2002/12/29 21:02:17 iliaa Exp $ */ #include stdio.h #include php.h @@ -120,7 +120,28 @@ while (1) { if (is_array) { - char *escaped_index; + char *escaped_index = NULL, *index_s; + int new_idx_len = 0; + + ip++; + index_s = ip; + if (isspace(*ip)) { + ip++; + } + if (*ip==']') { + index_s = NULL; + } else { + ip = strchr(ip, ']'); + if (!ip) { + /* PHP variables cannot contain '[' in their +names, so we replace the character with a '_' */ + *(index_s - 1) = '_'; + index_len = var_len = strlen(var); + goto plain_var; + return; + } + *ip = 0; + new_idx_len = strlen(index_s); + } if (!index) { MAKE_STD_ZVAL(gpc_element); @@ -148,22 +169,9 @@ } symtable1 = Z_ARRVAL_PP(gpc_element_p); /* ip pointed to the '[' character, now obtain the key */ - index = ++ip; - index_len = 0; - if (*ip=='\n' || *ip=='\r' || *ip=='\t' || *ip==' ') { - ip++; - } - if (*ip==']') { - index = NULL; - } else { - ip = strchr(ip, ']'); - if (!ip) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, Missing ] in %s variable, var); - return; - } - *ip = 0; - index_len = strlen(index); - } + index = index_s; + index_len = new_idx_len; + ip++; if (*ip=='[') { is_array = 1; @@ -172,6 +180,7 @@ is_array = 0; } } else { +plain_var: MAKE_STD_ZVAL(gpc_element); gpc_element-value = val-value; Z_TYPE_P(gpc_element) = Z_TYPE_P(val); Index: php4/main/rfc1867.c diff -u php4/main/rfc1867.c:1.128 php4/main/rfc1867.c:1.129 --- php4/main/rfc1867.c:1.128 Sat Dec 14 05:45:25 2002 +++ php4/main/rfc1867.c Sun Dec 29 16:02:17 2002 @@ -16,7 +16,7 @@ | Jani Taskinen [EMAIL PROTECTED] | +--+ */ -/* $Id: rfc1867.c,v 1.128 2002/12/14 10:45:25 sesser Exp $ */ +/* $Id: rfc1867.c,v 1.129 2002/12/29 21:02:17 iliaa Exp $ */ /* * This product includes software developed by the Apache Group @@ -104,7 +104,7 @@ /* done? */ while (index) { - + while (*index == ' ' || *index == '\r' || *index == '\n' || *index=='\t') { index++; } @@ -891,8 +891,11 @@ * ends in [.*] * start_arr is set to point to 1st [ */ - is_arr_upload = (start_arr = strchr(param,'[')) - (param[strlen(param)-1] == ']'); + is_arr_upload = (start_arr = strchr(param,'[')) +(param[strlen(param)-1] == ']'); + /* handle unterminated [ */ + if (!is_arr_upload start_arr) { + *start_arr = '_'; + } if (is_arr_upload) { array_len =
Re: [PHP-CVS] cvs: php4 /main php_variables.c rfc1867.c
Are you going to merge this into PHP_4_3? On Sun, 29 Dec 2002, Ilia Alshanetsky wrote: iliaa Sun Dec 29 16:02:17 2002 EDT Modified files: /php4/mainphp_variables.c rfc1867.c Log: Fixed bug #21149 (fixed handling of unterminated '['). -Andrei http://www.gravitonic.com/ * http://www.zend.com/comm_person.php?id=24 * -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /main php_variables.c
iliaa Sat Dec 7 11:05:27 2002 EDT Modified files: /php4/main php_variables.c Log: Fixed bug #20796. $_GET/$_POST/$_COOKIE data can get overwritten when register_globals are on and input contains arrays. Index: php4/main/php_variables.c diff -u php4/main/php_variables.c:1.45 php4/main/php_variables.c:1.46 --- php4/main/php_variables.c:1.45 Sun Oct 13 04:38:09 2002 +++ php4/main/php_variables.c Sat Dec 7 11:05:27 2002 @@ -16,7 +16,7 @@ | Zeev Suraski [EMAIL PROTECTED]| +--+ */ -/* $Id: php_variables.c,v 1.45 2002/10/13 08:38:09 shane Exp $ */ +/* $Id: php_variables.c,v 1.46 2002/12/07 16:05:27 iliaa Exp $ */ #include stdio.h #include php.h @@ -70,15 +70,15 @@ assert(var != NULL); - if (PG(register_globals)) { - symtable1 = EG(active_symbol_table); - } if (track_vars_array) { + symtable1 = Z_ARRVAL_P(track_vars_array); + } + if (PG(register_globals)) { if (symtable1) { - symtable2 = Z_ARRVAL_P(track_vars_array); + symtable2 = EG(active_symbol_table); } else { - symtable1 = Z_ARRVAL_P(track_vars_array); - } + symtable1 = EG(active_symbol_table); + } } if (!symtable1) { /* Nothing to do */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /main php_variables.c php_variables.h
shane Sun Oct 13 04:38:09 2002 EDT Modified files: /php4/main php_variables.c php_variables.h Log: make php_import_environment_variables overwritable so fastcgi can correctly set $_ENV. Index: php4/main/php_variables.c diff -u php4/main/php_variables.c:1.44 php4/main/php_variables.c:1.45 --- php4/main/php_variables.c:1.44 Sat Sep 7 20:27:05 2002 +++ php4/main/php_variables.c Sun Oct 13 04:38:09 2002 @@ -16,7 +16,7 @@ | Zeev Suraski [EMAIL PROTECTED]| +--+ */ -/* $Id: php_variables.c,v 1.44 2002/09/08 00:27:05 yohgaki Exp $ */ +/* $Id: php_variables.c,v 1.45 2002/10/13 08:38:09 shane Exp $ */ #include stdio.h #include php.h @@ -28,6 +28,9 @@ #include zend_globals.h +/* for systems that need to override reading of environment variables */ +void _php_import_environment_variables(zval *array_ptr TSRMLS_DC); +PHPAPI void (*php_import_environment_variables)(zval *array_ptr TSRMLS_DC) = +_php_import_environment_variables; PHPAPI void php_register_variable(char *var, char *strval, zval *track_vars_array TSRMLS_DC) { @@ -318,8 +321,7 @@ } } - -void php_import_environment_variables(zval *array_ptr TSRMLS_DC) +void _php_import_environment_variables(zval *array_ptr TSRMLS_DC) { char **env, *p, *t; Index: php4/main/php_variables.h diff -u php4/main/php_variables.h:1.13 php4/main/php_variables.h:1.14 --- php4/main/php_variables.h:1.13 Tue Dec 11 10:31:05 2001 +++ php4/main/php_variables.h Sun Oct 13 04:38:09 2002 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: php_variables.h,v 1.13 2001/12/11 15:31:05 sebastian Exp $ */ +/* $Id: php_variables.h,v 1.14 2002/10/13 08:38:09 shane Exp $ */ #ifndef PHP_VARIABLES_H #define PHP_VARIABLES_H @@ -31,7 +31,7 @@ #define PARSE_STRING 3 void php_treat_data(int arg, char *str, zval* destArray TSRMLS_DC); -PHPAPI void php_import_environment_variables(zval *array_ptr TSRMLS_DC); +extern PHPAPI void (*php_import_environment_variables)(zval *array_ptr TSRMLS_DC); PHPAPI void php_register_variable(char *var, char *val, pval *track_vars_array TSRMLS_DC); /* binary-safe version */ PHPAPI void php_register_variable_safe(char *var, char *val, int val_len, pval *track_vars_array TSRMLS_DC); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php