jani            Wed Aug  8 07:41:09 2007 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src    NEWS 
    /php-src/ext/standard       array.c 
  Log:
  - Fixed bug #42233 (Problems with æøå in extract()).
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.883&r2=1.2027.2.547.2.884&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.883 php-src/NEWS:1.2027.2.547.2.884
--- php-src/NEWS:1.2027.2.547.2.883     Wed Aug  8 02:16:41 2007
+++ php-src/NEWS        Wed Aug  8 07:41:09 2007
@@ -3,6 +3,7 @@
 ?? 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)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.30&r2=1.308.2.21.2.31&diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.30 
php-src/ext/standard/array.c:1.308.2.21.2.31
--- php-src/ext/standard/array.c:1.308.2.21.2.30        Sun Jun 24 17:37:01 2007
+++ php-src/ext/standard/array.c        Wed Aug  8 07:41:09 2007
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.30 2007/06/24 17:37:01 iliaa Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.31 2007/08/08 07:41:09 jani Exp $ */
 
 #include "php.h"
 #include "php_ini.h"
@@ -1286,18 +1286,29 @@
        
        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;
 }
 /* }}} */

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to