On Wed, Apr 1, 2015 at 7:08 PM, Michael Wallner <m...@php.net> wrote:

>
> > On 01 04 2015, at 18:15, Dan Ackroyd <dan...@basereality.com> wrote:
> >
> > Hi,
> >
> > I'd like to get people's feedback for the idea of making setlocale be
> > either deprecated and to be removed eventually or just increasing the
> > warning level against people using it.
> >
> > The short version of why we should do this is that setlocale breaks
> > things. It is a process wide operation, that is not thread safe on
> > most platforms. Although people use it to alter the way strings are
> > output, it also breaks libraries that are assuming that they are
> > running in a "C" locale.
> >
> > https://bugs.php.net/bug.php?id=59571 - breaks Imagick
> > https://bugs.php.net/bug.php?id=54538 - breaks NumberFormatter
> > https://bugs.php.net/bug.php?id=66108 - breaks constants
> > https://bugs.php.net/bug.php?id=67127 - breaks DateTime
> > https://bugs.php.net/bug.php?id=69348 - breaks MySQL
> >
> > And there are quite a few other bug reports where setlocale is doing
> > exactly what it is meant to do, but the unexpected side-effects are
> > catching people out.
> >
> > We have libraries that ship with PHP for formatting dates, numbers etc
> > that actually work, and don't break other libraries.
> >
> > So two questions:
> >
> > i) Are there any reasons why we couldn't or shouldn't plan for
> > removing setlocale at some point in the future? i.e. does it do
> > something that isn't supported by other libraries in PHP?
> >
>
> -1
> I don’t hink that we should restrict access to standard library functions
> just because something might break due to usage under wrong assumptions.
>
> > ii) If it's not possible (or desirable) to remove it, how could we
> > increase the warning level against using it?
>
>
maybe we could try something to mark/warn extension which aren't thread
safe when using in a TS build, but other than that I think it is just an
education/documentation problem.
(and removing something which works without having an alternative is bad in
my book)

-- 
Ferenc Kovács
@Tyr43l - http://tyrael.hu

Reply via email to