On Wed, 28 Feb 2001, Jim Winstead wrote:
>In article <[EMAIL PROTECTED]>,
>[EMAIL PROTECTED] wrote:
>> Hi there,
>>
>> I just came across something very odd:
>>
>> After setting
>>
>> arg_separator = "&"
>>
>> in my php.ini Tobias Ratschiller's phpMyAdmin no longer works
>> correctly.
>>
>> The start page loads correctly, every page thereafter dies with an SQL
>> error.
>
>things break because someone was dumb and used the "arg_separator" that
>used to be used to handle parsing the incoming request to also handle the
>parsing that the session-id adding stuff does, and then changed the
>documentation for arg_separator without regard to the existing behavior.
>
>so the get parsing is now expecting to use & to separate arguments
>when you set arg_separator that way.
>
>there should be two config variables for this.
This little patch (hack, I know :) addresses this problem.
Please check it out and tell me whether it could be committed
or not. This hack relies on the fact that only & and ; are
supported by browsers.
--Jani
Index: php_variables.c
===================================================================
RCS file: /repository/php4/main/php_variables.c,v
retrieving revision 1.21
diff -u -r1.21 php_variables.c
--- php_variables.c 2001/02/26 06:07:31 1.21
+++ php_variables.c 2001/03/11 05:52:51
@@ -218,7 +218,7 @@
void php_treat_data(int arg, char *str, zval* destArray ELS_DC PLS_DC
SLS_DC)
{
char *res = NULL, *var, *val;
- const char *c_var;
+ const char *c_var, *delim;
pval *array_ptr;
int free_buffer=0;
char *strtok_buf = NULL;
@@ -277,12 +277,16 @@
return;
}
+ if (PG(arg_separator) != ";") {
+ delim = "&";
+ } else {
+ delim = ";";
+ }
+
if (arg == PARSE_COOKIE) {
var = php_strtok_r(res, ";", &strtok_buf);
- } else if (arg == PARSE_POST) {
- var = php_strtok_r(res, "&", &strtok_buf);
} else {
- var = php_strtok_r(res, PG(arg_separator), &strtok_buf);
+ var = php_strtok_r(res, delim, &strtok_buf);
}
while (var) {
@@ -298,7 +302,7 @@
if (arg == PARSE_COOKIE) {
var = php_strtok_r(NULL, ";", &strtok_buf);
} else {
- var = php_strtok_r(NULL, PG(arg_separator), &strtok_buf);
+ var = php_strtok_r(NULL, delim, &strtok_buf);
}
}
if (free_buffer) {
--
PHP Development 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]