Re: setlocale Apache/PHP problem - tentative bug.
| From: | Jouni Ahto | Date: | Thu, 07 Oct 1999 22:07:58 +0000 |
| Subject: | Re: setlocale Apache/PHP problem - tentative bug. | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-11612@lists.php.net to get a copy of this message | ||
On Thu, 7 Oct 1999, Christian Reis wrote:
> On Wed, 6 Oct 1999, Stephen Langasek wrote:
>
> > The "proper" solution is for PHP's setlocale() function to save the
> > original
> > locale the first time the function is called in a script, and restore this
> > locale when PHP cleans up on exit. PHP scripts should not be able to affect
> > the web server's execution environment in this manner, and it shouldn't be
> > the script programmer's responsibility to clean up afterwards.
I disagree, but only slightly. The proper thing to do is to set locale to
"C" if it was changed, which is the state (i mean "C", of course) in which
programs start and stay, unless they explicitly call setlocale to change
it. PHP doesn't and webservers (to my knowledge) generally don't. If this
breaks some webserver, only then should it be necessary to actually save
the state of current locale at request startup and restore it at request
end, mainly because it saves us the overhead of calling setlocale on every
request if not necessary.
> I completely agree; this behaviour is completely unexpected and quite
> misleading, the problem goes as far as messing apache-1.3.6's logs - newer
> apache-1.3.9 doesn't have this specific log problem, but I can't really
> see where it was fixed. Dates on the log appear sometimes in the default
> "C" locale, sometimes in another.
>
> Should this be posted to php-bug, or is _this list_ php-bug effectively?
http://bugs.php.net/
-- Jouni Ahto