iliaa Mon Dec 30 10:35:55 2002 EDT
Modified files: (Branch: PHP_4_3)
/php4/main php_variables.c rfc1867.c
Log:
MFH
Index: php4/main/php_variables.c
diff -u php4/main/php_variables.c:1.45.2.1 php4/main/php_variables.c:1.45.2.2
--- php4/main/php_variables.c:1.45.2.1 Sat Dec 7 11:06:40 2002
+++ php4/main/php_variables.c Mon Dec 30 10:35:55 2002
@@ -16,7 +16,7 @@
| Zeev Suraski <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_variables.c,v 1.45.2.1 2002/12/07 16:06:40 iliaa Exp $ */
+/* $Id: php_variables.c,v 1.45.2.2 2002/12/30 15:35:55 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.122.2.6 php4/main/rfc1867.c:1.122.2.7
--- php4/main/rfc1867.c:1.122.2.6 Tue Dec 10 10:59:17 2002
+++ php4/main/rfc1867.c Mon Dec 30 10:35:55 2002
@@ -16,7 +16,7 @@
| Jani Taskinen <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: rfc1867.c,v 1.122.2.6 2002/12/10 15:59:17 iliaa Exp $ */
+/* $Id: rfc1867.c,v 1.122.2.7 2002/12/30 15:35:55 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++;
}
@@ -897,8 +897,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 = strlen(start_arr);
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php