Re: Zend Constants PATCH
| From: | Ilia A. | Date: | Tue, 18 Jun 2002 14:19:06 +0000 |
| Subject: | Re: Zend Constants PATCH | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-85301@lists.php.net to get a copy of this message | ||
On June 18, 2002 05:32 am, Hartmut Holzgraefe wrote:
> Andi Gutmans wrote:
> > Hi,
> >
> > I'll try and get the patch into PHP soon (I was busy with other things)
> > I want to rewrite it a bit to make it nicer.
>
> does the case-sensitive, then case-insensitive logic really make
> that much sense? wouldn't it be easier *and* more consistent to
> make zend_str_tolower() not use libc tolower() but some locale-insensitive
> code instead? or am i missing something?
>
> btw, the use of strtod() within the engine is a similar problem
> the lexer always looks for '.' as decimal_point (which is right)
> but then uses strtod() to convert the found string into a double
> without taking in account that the decimal_point in the current
> locale may be a different character so that parsing stops at the '.',
> cutting off all decimals
> so strtod() should be replaced by something not locale-aware
> (and no, atof() is not what we are looking for) or replace the '.'
> with whatever decimal_point is set to in the current locale
>
> first solution would perform better, but from looking at the OpenBSD
> implementation of strtod() i think the second has far less potential
> for problems while not performing to bad if decimal_point is cached
> somehow ...
By using a functiont that does not support lowercasing, would also cause
problems, since if a constant name contains non english characters it would
break. IMHO the best implementation is to simply not lowercase constant names
unless the user specifically whats case insensetive locale.
>
> PS: IMHO we have to rethink the complete set_locale() stuff in PHP
> as there is absolutely no way to make it work in threaded SAPIs :(
Doesn't work, simply not true. My PHP code uses locales extensively and it
works just fine on Apache 2.0 (threads model) and on IIS, which uses threads.
Ilia