sniper Thu Apr 5 19:09:44 2001 EDT Modified files: (Branch: PHP_4_0_5) /php4 NEWS php.ini-dist php.ini-optimized /php4/ext/standard url_scanner.c url_scanner_ex.c url_scanner_ex.re /php4/main main.c php_globals.h php_variables.c Log: MFH
Index: php4/NEWS diff -u php4/NEWS:1.611.2.2 php4/NEWS:1.611.2.3 --- php4/NEWS:1.611.2.2 Sun Apr 1 07:33:29 2001 +++ php4/NEWS Thu Apr 5 19:09:43 2001 @@ -2,7 +2,10 @@ ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 200?, Version 4.0.5 -- New FastCGI server module. (Ben Mansell) +- Added new php.ini directive: arg_separator.input which is used to tell + PHP which characters are considered as argument separators in URLs. + Renamed php.ini directive: arg_separator -> arg_separator.output (Jani) +- Added FastCGI SAPI module. (Ben Mansell) - Added array_reduce(), which allows iterative reduction of an array to a single value via a callback function. (Andrei) - The imageloadfont function of the gd extension should be not platform Index: php4/php.ini-dist diff -u php4/php.ini-dist:1.73 php4/php.ini-dist:1.73.2.1 --- php4/php.ini-dist:1.73 Wed Mar 7 02:08:19 2001 +++ php4/php.ini-dist Thu Apr 5 19:09:43 2001 @@ -1,5 +1,5 @@ [PHP] -; $Id: php.ini-dist,v 1.73 2001/03/07 10:08:19 zeev Exp $ +; $Id: php.ini-dist,v 1.73.2.1 2001/04/06 02:09:43 sniper Exp $ ;;;;;;;;;;;;;;;;;;; ; About this file ; @@ -243,7 +243,12 @@ ; The separator used in PHP generated URLs to separate arguments. ; Default is "&". -;arg_separator = "&" +;arg_separator.output = "&" + +; List of separator(s) used by PHP to parse input URLs into variables. +; Default is "&". +; NOTE: Every character in this directive is considered as separator! +;arg_separator.input = ";&" ; This directive describes the order in which PHP registers GET, POST, Cookie, ; Environment and Built-in variables (G, P, C, E & S respectively, often Index: php4/php.ini-optimized diff -u php4/php.ini-optimized:1.33 php4/php.ini-optimized:1.33.2.1 --- php4/php.ini-optimized:1.33 Wed Mar 7 02:08:19 2001 +++ php4/php.ini-optimized Thu Apr 5 19:09:43 2001 @@ -182,8 +182,14 @@ ;;;;;;;;;;;;;;;;; ; Data Handling ; ;;;;;;;;;;;;;;;;; -;arg_separator = "&" ; The separator used in PHP generated URLs to separate arguments. - ; Default is "&". + +;arg_separator.output = "&" ; The separator used in PHP generated URLs to +separate arguments. + ; Default is "&". + +;arg_separator.input = ";&" ; List of separator(s) used by PHP to parse +input URLs into variables. + ; Default is "&". + ; NOTE: Every +character in this directive is considered as separator! + variables_order = "GPCS" ; This directive describes the order in which PHP registers ; GET, POST, Cookie, Environment and Built-in variables (G, P, ; C, E & S respectively, often referred to as EGPCS or GPC). Index: php4/ext/standard/url_scanner.c diff -u php4/ext/standard/url_scanner.c:1.29 php4/ext/standard/url_scanner.c:1.29.2.1 --- php4/ext/standard/url_scanner.c:1.29 Sun Feb 25 22:07:23 2001 +++ php4/ext/standard/url_scanner.c Thu Apr 5 19:09:43 2001 @@ -15,7 +15,7 @@ | Author: Hartmut Holzgraefe <[EMAIL PROTECTED]> | +----------------------------------------------------------------------+ */ -/* $Id: url_scanner.c,v 1.29 2001/02/26 06:07:23 andi Exp $ */ +/* $Id: url_scanner.c,v 1.29.2.1 2001/04/06 02:09:43 sniper Exp $ */ #include "php.h" @@ -67,12 +67,12 @@ if(flag) { if(!strstr(val,buf)&&!strchr(val,':')) { - char *result = (char *)emalloc(strlen(buf)+strlen(PG(arg_separator))+1); + char *result = (char +*)emalloc(strlen(buf)+strlen(PG(arg_separator).output)+1); int n; if(strchr(val,'?')) { - strcpy(result,PG(arg_separator)); - n=strlen(PG(arg_separator)); + strcpy(result,PG(arg_separator).output); + n=strlen(PG(arg_separator).output); } else { *result='?'; n=1; Index: php4/ext/standard/url_scanner_ex.c diff -u php4/ext/standard/url_scanner_ex.c:1.29 php4/ext/standard/url_scanner_ex.c:1.29.2.1 --- php4/ext/standard/url_scanner_ex.c:1.29 Sun Feb 25 22:07:23 2001 +++ php4/ext/standard/url_scanner_ex.c Thu Apr 5 19:09:43 2001 @@ -1,5 +1,5 @@ -/* Generated by re2c 0.5 on Tue Jan 9 17:13:20 2001 */ -#line 1 "/home/sas/src/php4/ext/standard/url_scanner_ex.re" +/* Generated by re2c 0.5 on Wed Apr 4 19:29:46 2001 */ +#line 1 "/usr/src/web/php/php4/ext/standard/url_scanner_ex.re" /* +----------------------------------------------------------------------+ | PHP version 4.0 | @@ -140,7 +140,7 @@ smart_str_appendc(&ctx->result, quote); if (f) { - append_modified_url(&ctx->val, &ctx->result, &ctx->q_name, &ctx->q_value, PG(arg_separator)); + append_modified_url(&ctx->val, &ctx->result, &ctx->q_name, +&ctx->q_value, PG(arg_separator).output); } else { smart_str_append(&ctx->result, &ctx->val); } @@ -670,7 +670,7 @@ smart_str_sets(&sname, name); smart_str_sets(&sval, value); - append_modified_url(&surl, &buf, &sname, &sval, PG(arg_separator)); + append_modified_url(&surl, &buf, &sname, &sval, PG(arg_separator).output); smart_str_0(&buf); if (newlen) *newlen = buf.len; Index: php4/ext/standard/url_scanner_ex.re diff -u php4/ext/standard/url_scanner_ex.re:1.30 php4/ext/standard/url_scanner_ex.re:1.30.2.1 --- php4/ext/standard/url_scanner_ex.re:1.30 Sun Feb 25 22:07:23 2001 +++ php4/ext/standard/url_scanner_ex.re Thu Apr 5 19:09:43 2001 @@ -138,7 +138,7 @@ smart_str_appendc(&ctx->result, quote); if (f) { - append_modified_url(&ctx->val, &ctx->result, &ctx->q_name, &ctx->q_value, PG(arg_separator)); + append_modified_url(&ctx->val, &ctx->result, &ctx->q_name, +&ctx->q_value, PG(arg_separator).output); } else { smart_str_append(&ctx->result, &ctx->val); } @@ -313,7 +313,7 @@ smart_str_sets(&sname, name); smart_str_sets(&sval, value); - append_modified_url(&surl, &buf, &sname, &sval, PG(arg_separator)); + append_modified_url(&surl, &buf, &sname, &sval, PG(arg_separator).output); smart_str_0(&buf); if (newlen) *newlen = buf.len; Index: php4/main/main.c diff -u php4/main/main.c:1.356.2.1 php4/main/main.c:1.356.2.2 --- php4/main/main.c:1.356.2.1 Sat Mar 17 16:11:15 2001 +++ php4/main/main.c Thu Apr 5 19:09:43 2001 @@ -19,7 +19,7 @@ */ -/* $Id: main.c,v 1.356.2.1 2001/03/18 00:11:15 zeev Exp $ */ +/* $Id: main.c,v 1.356.2.2 2001/04/06 02:09:43 sniper Exp $ */ #include <stdio.h> @@ -209,7 +209,9 @@ STD_PHP_INI_BOOLEAN("track_errors", "0", PHP_INI_ALL, OnUpdateBool, track_errors, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("y2k_compliance", "0", PHP_INI_ALL, OnUpdateBool, y2k_compliance, php_core_globals, core_globals) - STD_PHP_INI_ENTRY("arg_separator", "&", PHP_INI_ALL, OnUpdateStringUnempty, arg_separator, php_core_globals, core_globals) + STD_PHP_INI_ENTRY("arg_separator.output", "&", PHP_INI_ALL, + OnUpdateStringUnempty, arg_separator.output, php_core_globals, +core_globals) + STD_PHP_INI_ENTRY("arg_separator.input", "&", +PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateStringUnempty, arg_separator.input, +php_core_globals, core_globals) + STD_PHP_INI_ENTRY("auto_append_file", NULL, PHP_INI_ALL, OnUpdateString, auto_append_file, php_core_globals, core_globals) STD_PHP_INI_ENTRY("auto_prepend_file", NULL, PHP_INI_ALL, OnUpdateString, auto_prepend_file, php_core_globals, core_globals) STD_PHP_INI_ENTRY("doc_root", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, doc_root, php_core_globals, core_globals) Index: php4/main/php_globals.h diff -u php4/main/php_globals.h:1.62 php4/main/php_globals.h:1.62.2.1 --- php4/main/php_globals.h:1.62 Sun Feb 25 22:07:31 2001 +++ php4/main/php_globals.h Thu Apr 5 19:09:43 2001 @@ -52,6 +52,11 @@ struct _php_tick_function_entry; +typedef struct _arg_separators { + char *output; + char *input; +} arg_separators; + struct _php_core_globals { zend_bool magic_quotes_gpc; zend_bool magic_quotes_runtime; @@ -92,8 +97,9 @@ char *auto_prepend_file; char *auto_append_file; + + arg_separators arg_separator; - char *arg_separator; char *gpc_order; char *variables_order; Index: php4/main/php_variables.c diff -u php4/main/php_variables.c:1.21.2.1 php4/main/php_variables.c:1.21.2.2 --- php4/main/php_variables.c:1.21.2.1 Tue Mar 27 06:03:03 2001 +++ php4/main/php_variables.c Thu Apr 5 19:09:43 2001 @@ -16,7 +16,7 @@ | Zeev Suraski <[EMAIL PROTECTED]> | +----------------------------------------------------------------------+ */ -/* $Id: */ +/* $Id: php_variables.c,v 1.21.2.2 2001/04/06 02:09:43 sniper Exp $ */ #include <stdio.h> #include "php.h" @@ -217,7 +217,7 @@ void php_treat_data(int arg, char *str, zval* destArray ELS_DC PLS_DC SLS_DC) { - char *res = NULL, *var, *val; + char *res = NULL, *var, *val, *separator=NULL; const char *c_var; pval *array_ptr; int free_buffer=0; @@ -252,7 +252,7 @@ return; } - if (arg == PARSE_GET) { /* GET data */ + if (arg == PARSE_GET) { /* GET data */ c_var = SG(request_info).query_string; if (c_var && *c_var) { res = (char *) estrdup(c_var); @@ -277,8 +277,18 @@ return; } - var = php_strtok_r(res, ";&", &strtok_buf); - + switch (arg) { + case PARSE_GET: + case PARSE_STRING: + separator = (char *) estrdup(PG(arg_separator).input); + break; + case PARSE_COOKIE: + separator = ";\0"; + break; + } + + var = php_strtok_r(res, separator, &strtok_buf); + while (var) { val = strchr(var, '='); if (val) { /* have a value */ @@ -289,8 +299,13 @@ val_len = php_url_decode(val, strlen(val)); php_register_variable_safe(var, val, val_len, array_ptr ELS_CC PLS_CC); } - var = php_strtok_r(NULL, ";&", &strtok_buf); + var = php_strtok_r(NULL, separator, &strtok_buf); } + + if(arg != PARSE_COOKIE) { + efree(separator); + } + if (free_buffer) { efree(res); }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]