Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85643 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 34114 invoked from network); 1 Apr 2015 17:18:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Apr 2015 17:18:28 -0000 Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.182 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.214.182 mail-ob0-f182.google.com Received: from [209.85.214.182] ([209.85.214.182:34742] helo=mail-ob0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EB/02-21906-3682C155 for ; Wed, 01 Apr 2015 12:18:27 -0500 Received: by obbgh1 with SMTP id gh1so84523927obb.1 for ; Wed, 01 Apr 2015 10:18:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=E+JIJw/wU6JQVp4tS9ssyVBHBykYkZ2FLRbbRVwmqQo=; b=eSApn+vNwrwbgfsLkSizxp2nld8OkcJAPlQJVxUxptVi6QH6EcMnV0gfVwOxNrKmki yz2AT0jhNuBHjFnRj70zys3bWQrNnNHXBI6WlDGv4o/NfUz9fZ5e46Yi+JULpXuIpv9n E5hsx9NGbYRDHbsTrGAPwXqlwWCzoUs2yhbeX8AKdbw6XlcOR1V6J70ZIrnMiXl5KKWR MS7mBuR9bFqG7kNw2cIR8pD0z9ovPXvM0abLk8WofXREGrBbS9CKfDa/31udqws12kuS kXOpxZRvVUXgJ5PX8VzAdTdnq18pwyMe2IeXhCqwT2R0/nl3CMGDw6e3jDROvvtYBMIq VgmQ== MIME-Version: 1.0 X-Received: by 10.60.131.206 with SMTP id oo14mr41863130oeb.30.1427908701541; Wed, 01 Apr 2015 10:18:21 -0700 (PDT) Received: by 10.60.81.201 with HTTP; Wed, 1 Apr 2015 10:18:21 -0700 (PDT) In-Reply-To: References: Date: Wed, 1 Apr 2015 19:18:21 +0200 Message-ID: To: Michael Wallner Cc: Dan Ackroyd , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=047d7b4724aced59bb0512ace6b9 Subject: Re: [PHP-DEV] Deprecate setlocale? From: tyra3l@gmail.com (Ferenc Kovacs) --047d7b4724aced59bb0512ace6b9 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, Apr 1, 2015 at 7:08 PM, Michael Wallner wrote: > > > On 01 04 2015, at 18:15, Dan Ackroyd 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=3D59571 - breaks Imagick > > https://bugs.php.net/bug.php?id=3D54538 - breaks NumberFormatter > > https://bugs.php.net/bug.php?id=3D66108 - breaks constants > > https://bugs.php.net/bug.php?id=3D67127 - breaks DateTime > > https://bugs.php.net/bug.php?id=3D69348 - 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=E2=80=99t hink that we should restrict access to standard library f= unctions > 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) --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu --047d7b4724aced59bb0512ace6b9--