Re: Complete case-sensitivity in PHP
| From: | Galen Wright-Watson | Date: | Sat, 21 Apr 2012 01:37:42 +0000 |
| Subject: | Re: Complete case-sensitivity in PHP | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-60249@lists.php.net to get a copy of this message | ||
On Fri, Apr 20, 2012 at 3:20 AM, C.Koy <can5koy@gmail.com> wrote:
>
> As the recent comments on that page indicate, there's not a deterministic
> way to resolve this issue, apart from eliminating tolower() calls for
> function/class names during lookup. Hence totally case-sensitive PHP.
>
>
What about instead creating a special-purpose Zend function to normalize
class names (zend_normalize_class_name, or zend_classname_tolower)? This
function would examine the current locale and, if it's a problematic one,
convert the string to lower case on its own (calling zend_tolower on
non-problematic characters). Alternatively, zend_normalize_class_name could
switch LC_CTYPE to an appropriate locale (e.g. "UTF-8"; the locale could be
determined at compile time), call zend_str_tolower_copy, then switch back
before returning. Then, any appropriate function (e.g.
zend_resolve_class_name, zend_lookup_class_ex, class_exists, class_alias)
would call zend_normalize_class_name instead of zend_str_tolower_copy/
zend_str_tolower_dup.
The two problems with this approach are
1) additional time-cost. However, if done right, this should have little
impact.
2) break class names using words in the locale-language. For example, a
class named "IzgaraGörünümü" would be converted to "izgaragörünümü",
rather
than "ızgaragörünümü". However, this impact should be less than that caused
by the current bug.
Does this bug pop-up for locales other than Turkish, Azerbaijani and Kurdish
?