Bug #16865 Updated: constants get undefined if setting locale to tr_TR
| From: | ilia at prohost dot org | Date: | Mon, 10 Jun 2002 16:24:46 +0000 |
| Subject: | Bug #16865 Updated: constants get undefined if setting locale to tr_TR | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-10029@lists.php.net to get a copy of this message | ||
ID: 16865
Updated by: ilia@prohost.org
Reported By: jan@horde.org
Status: Analyzed
Bug Type: Scripting Engine problem
Operating System: Linux
PHP Version: 4.0CVS-2002-04-26
New Comment:
This bug can be resolved by applying the patch below to
zend_constants.c
--- 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_PERSIST
Previous Comments:
------------------------------------------------------------------------
[2002-04-29 04:07:42] jan@horde.org
It works indeed if you set the locale before calling the php script.
But this is of course not practicable.
------------------------------------------------------------------------
[2002-04-28 21:11:41] sniper@php.net
Not sure whether it happens because tr_TR locale is broken?
When these constants are defined, they are defined using
the current locale whatever it was when PHP starts.
So, it you do this:
# export LC_ALL=tr_TR
# php -f test.php
And it works..
So when constants are searched from the hash, same locale should be
used which was used when they were registered.
--Jani
------------------------------------------------------------------------
[2002-04-26 19:18:54] jan@horde.org
This one is a very strange one. It seems like some constants are
getting undefined if you set the locale to tr_TR. It happens randomly
with internally defined and user defined constants and is reproducable
with this little script:
<?php
setlocale(LC_ALL, 'tr_TR');
echo extension_loaded('imap');
echo SORTARRIVAL;
?>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=16865&edit=1