Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60424 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24415 invoked from network); 2 May 2012 19:03:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 May 2012 19:03:59 -0000 Authentication-Results: pb1.pair.com header.from=ww.galen@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ww.galen@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.42 as permitted sender) X-PHP-List-Original-Sender: ww.galen@gmail.com X-Host-Fingerprint: 209.85.213.42 mail-yw0-f42.google.com Received: from [209.85.213.42] ([209.85.213.42:60881] helo=mail-yw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7D/E1-10491-D1581AF4 for ; Wed, 02 May 2012 15:03:58 -0400 Received: by yhfq11 with SMTP id q11so1189577yhf.29 for ; Wed, 02 May 2012 12:03:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=6l0p9QlTHpEo1zWECJDAOg+U1b3nwngqcmZp7yueKas=; b=DB3kTKr02q/BCq9aQfJTW39lRPVBpOQYhiOkd4qotFDAgmV+JB5j0a7fUTCrLG/JYo OlH9ixperO7J1Q6TRWciOizeOWiTSFImQzIAsCzDg5Tad0S7I8J0kqPGtXFeSa+gv8j4 JEfakoCC56uUxgbKakXSRlMVs5VG0wdkEW7BSOAsWpvNK3Tq8D8YkY41vY2TKWoGXZtv 5PLhBF1qLN/k4Y6fRVdw9gTaMsL4WH6ZV9YyHRkbrdPmxX1jySOrE96uuiE66GiWmZnN hc4gESs2jA2b2UQ/XVCNQjpTRdP3oDr77yrzpZkR48sZpVLzMVE83DQqAiDqWa7Lu00k /M+A== Received: by 10.42.28.9 with SMTP id l9mr3993247icc.31.1335985433768; Wed, 02 May 2012 12:03:53 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.144.201 with HTTP; Wed, 2 May 2012 12:03:13 -0700 (PDT) In-Reply-To: References: Date: Wed, 2 May 2012 12:03:13 -0700 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary=20cf301d41c03472e404bf12594f Subject: Re: [PHP-DEV] Fixing bug #18556 (was: Complete case-sensitivity in PHP) From: ww.galen@gmail.com (Galen Wright-Watson) --20cf301d41c03472e404bf12594f Content-Type: text/plain; charset=ISO-8859-1 On Wed, May 2, 2012 at 5:23 AM, C.Koy wrote: > On 5/1/2012 9:11 PM, Galen Wright-Watson wrote: > >> On Thu, Apr 26, 2012 at 3:45 AM, C.Koy 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. >> >> > 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 ? > > Do you mean something like the following? >> 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. > > Yup. $ LC_CTYPE=tr_TR php [...] > > > >> 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") > > That's indeed what I meant; basically, the locales specified in the LC_CTYPE &c. environment variables. It shouldn't matter that the default locale isn't "en_US" or "C", as long as PHP always uses the same locale for identifiers both during compilation and at run-time. Of course, it also makes a certain amount sense to explicitly decide that PHP will use a specific locale for identifiers. I avoided suggesting that route to avoid any issues about what locales will be universally available. > 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. > > That would set the locale to whatever the platform uses natively. Without the call, the locale would be "POSIX"/"C", according to the POSIX doc ( http://pubs.opengroup.org/onlinepubs/009604499/functions/setlocale.html). It doesn't seem terribly relevant to bug 18556, since all that matters regarding the initial locale is that its lowercase conversion is different from the locale that's used at run-time. If I had to guess why the locale is set to the platform native, it's so that numeric, currency and date formatting will be consistent with the rest of the system. --20cf301d41c03472e404bf12594f--