php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #64325
Patch bug64325.patch revision 2013-03-01 03:29 UTC by laruence@php.net

Patch bug64325.patch for *General Issues Bug #64325

Patch version 2013-03-01 03:29 UTC

Return to Bug #64325 | Download this patch
Patch Revisions:

Developer: laruence@php.net

diff --git a/main/php_variables.c b/main/php_variables.c
index cf2b623..843f8f5 100644
--- a/main/php_variables.c
+++ b/main/php_variables.c
@@ -152,10 +152,10 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars
 			if (isspace(*ip)) {
 				ip++;
 			}
-			if (*ip==']') {
+			if (*ip == ']' && *(ip + 1) != ']') {
 				index_s = NULL;
 			} else {
-				ip = strchr(ip, ']');
+				ip = strrchr(ip, ']');
 				if (!ip) {
 					/* PHP variables cannot contain '[' in their names, so we replace the character with a '_' */
 					*(index_s - 1) = '_';
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 08:01:28 2024 UTC