Bug #17658: defines do not work properly

From: Date: Sat, 08 Jun 2002 19:42:34 +0000
Subject: Bug #17658: defines do not work properly
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-9881@lists.php.net to get a copy of this message
From: ilia@prohost.org Operating system: Linux 2.4.18 PHP version: 4.0CVS-2002-06-08 PHP Bug Type: Scripting Engine problem Bug description: defines do not work properly <?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 bug report at http://bugs.php.net/?id=17658&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=17658&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=17658&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=17658&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=17658&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=17658&r=support Expected behavior: http://bugs.php.net/fix.php?id=17658&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=17658&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=17658&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=17658&r=globals

« previous php.bugs (#9881) next »