Re: Fixing bug #18556 (was: Complete case-sensitivity in PHP)

From: Date: Wed, 02 May 2012 12:23:08 +0000
Subject: Re: Fixing bug #18556 (was: Complete case-sensitivity in PHP)
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-60422@lists.php.net to get a copy of this message
On 5/1/2012 9:11 PM, Galen Wright-Watson wrote:
On Thu, Apr 26, 2012 at 3:45 AM, C.Koy<can5koy@gmail.com> wrote:
As of 5.3.0 this bug does not exist for function names. Only classes and interfaces.
Turns out, if you cause a function to be called dynamically by (e.g.) using a variable function, the bug will surface.
     <?php
     setlocale(LC_CTYPE, 'tr_TR');
     function IJK() {}
     # succeeds
     IJK();
If literal function call precedes the function definition, that would fail too in 5.2.17, but not in 5.3.0. What has changed in this regard 5.2->5.3 ?
     $f = 'IJK';
     # causes Fatal error: Call to undefined function IJK()
     $f();
In contrast, if you set the locale for LC_CTYPE on the command line, the bug doesn't arise at all because the compilation and execution phases both use the same locale.
So, the bug also arises if a script started in 'tr_TR' env locale sets its locale to 'en_US' at runtime. [...]
I like the idea of using the system default locale for name conversion (making name resolution independent of the current locale), but am
As I stated above, the locale the script was started in may not always be 'en_US' or 'C'. (assuming that's what you mean by "system default locale") By the way, I noticed a setlocale(LC_CTYPE, "") call in php_module_startup()/main.c, but can't figure if it has any relevance to this bug. regards,

« previous php.internals (#60422) next »