- Fixed bug #42233 (Problems with æøå in extract()).

This commit is contained in:
Jani Taskinen 2007-08-08 07:41:09 +00:00
parent 45e96efd1d
commit 0d5dd8829b
2 changed files with 21 additions and 9 deletions

1
NEWS
View File

@ -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)

View File

@ -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;
}
/* }}} */