Bug #17658 Updated: defines do not work properly

From: Date: Mon, 10 Jun 2002 11:06:42 +0000
Subject: Bug #17658 Updated: defines do not work properly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-10010@lists.php.net to get a copy of this message
ID: 17658 Updated by: derick@php.net Reported By: ilia@prohost.org -Status: Open +Status: Critical Bug Type: Scripting Engine problem Operating System: Linux 2.4.18 PHP Version: 4.0CVS-2002-06-08 Previous Comments: ------------------------------------------------------------------------ [2002-06-08 15:42:33] ilia@prohost.org <?php define('TEST', 'test#1'); define('test', 'test#2'); echo TEST."\n"; echo test."\n"; ?> Returns test#1 test The problem is the fault of zend_constants, which ALWAYS lowercases the define names when they are being stores/retrieved in/from the hash table. The same lowercasing code also causes i18n problems, with defines which do not support the characters in defines made prior to setlocale() function being called. Ref Bug #16865. The patch below fixes both problems --- zend_constants.c_old Sat Jun 8 15:58:01 2002 +++ zend_constants.c Sat Jun 8 15:58:09 2002 @@ -226,8 +226,6 @@ lookup_name = do_alloca(name_len+1); memcpy(lookup_name, name, name_len+1); - zend_str_tolower(lookup_name, name_len); - if (zend_hash_find(EG(zend_constants), lookup_name, name_len+1, (void **) &c)==SUCCESS) { if ((c->flags & CONST_CS) && memcmp(c->name, name, name_len)!=0) { retval=0; @@ -255,7 +253,6 @@ printf("Registering constant for module %d\n", c->module_number); #endif - zend_str_tolower(lowercase_name, c->name_len); if (zend_hash_add(EG(zend_constants), lowercase_name, c->name_len, (void *) c, sizeof(zend_constant), NULL)==FAILURE) { free(c->name); if (!(c->flags & CONST_PERSISTENT) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=17658&edit=1

« previous php.bugs (#10010) next »