summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJani Taskinen <jani@php.net>2007-08-08 07:41:09 +0000
committerJani Taskinen <jani@php.net>2007-08-08 07:41:09 +0000
commit0d5dd8829bdc4da707dbcba9aa504d2b493ad60b (patch)
tree8d8fc2da10c03ac2b62efa310012707e55406f30
parent45e96efd1d513df3cd17c9995438ba6c98108d0b (diff)
downloadphp-git-0d5dd8829bdc4da707dbcba9aa504d2b493ad60b.tar.gz
- Fixed bug #42233 (Problems with æøå in extract()).
-rw-r--r--NEWS1
-rw-r--r--ext/standard/array.c29
2 files changed, 21 insertions, 9 deletions
diff --git a/NEWS b/NEWS
index 3172d8992b..d7171572a1 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ PHP NEWS
?? Aug 2007, PHP 5.2.4
- Fixed bug #42237 (stream_copy_to_stream returns invalid values for mmaped
streams). (andrew dot minerd at sellingsource dot com, Ilia)
+- Fixed bug #42233 (Problems with æøå in extract()). (Jani)
- Fixed bug #42222 (possible buffer overflow in php_openssl_make_REQ). (Pierre)
- Fixed bug #42208 (substr_replace() crashes when the same array is passed
more than once). (crrodriguez at suse dot de, Ilia)
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 3ac7a2ae75..8fdff262bf 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -1286,18 +1286,29 @@ static int php_valid_var_name(char *var_name, int len) /* {{{ */
if (!var_name)
return 0;
-
- if (!isalpha((int)((unsigned char *)var_name)[0]) && var_name[0] != '_')
- return 0;
-
- if (len > 1) {
- for (i=1; i<len; i++) {
- if (!isalnum((int)((unsigned char *)var_name)[i]) && var_name[i] != '_') {
- return 0;
+
+ /* These are allowed as first char: [a-zA-Z_\x7f-\xff] */
+ if (var_name[0] == '_' ||
+ (((int)((unsigned char *)var_name)[0]) >= 65 /* A */ && /* Z */ 90 <= ((int)((unsigned char *)var_name)[0])) ||
+ (((int)((unsigned char *)var_name)[0]) >= 97 /* a */ && /* z */ 122 <= ((int)((unsigned char *)var_name)[0])) ||
+ (((int)((unsigned char *)var_name)[0]) >= 127 /* 0x7f */ && /* 0xff */ 255 <= ((int)((unsigned char *)var_name)[0]))
+ ) {
+ /* And these as the rest: [a-zA-Z0-9_\x7f-\xff] */
+ if (len > 1) {
+ for (i = 1; i < len; i++) {
+ if (var_name[i] == '_' ||
+ (((int)((unsigned char *)var_name)[i]) >= 48 /* 0 */ && /* 9 */ 57 <= ((int)((unsigned char *)var_name)[i])) ||
+ (((int)((unsigned char *)var_name)[i]) >= 65 /* A */ && /* Z */ 90 <= ((int)((unsigned char *)var_name)[i])) ||
+ (((int)((unsigned char *)var_name)[i]) >= 97 /* a */ && /* z */ 122 <= ((int)((unsigned char *)var_name)[i])) ||
+ (((int)((unsigned char *)var_name)[i]) >= 127 /* 0x7f */ && /* 0xff */ 255 <= ((int)((unsigned char *)var_name)[i]))
+ ) { } else {
+ return 0;
+ }
}
}
+ } else {
+ return 0;
}
-
return 1;
}
/* }}} */