Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85638 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24142 invoked from network); 1 Apr 2015 16:15:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Apr 2015 16:15:35 -0000 Authentication-Results: pb1.pair.com smtp.mail=danack@basereality.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=danack@basereality.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain basereality.com from 209.85.215.44 cause and error) X-PHP-List-Original-Sender: danack@basereality.com X-Host-Fingerprint: 209.85.215.44 mail-la0-f44.google.com Received: from [209.85.215.44] ([209.85.215.44:33778] helo=mail-la0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AA/20-21906-3A91C155 for ; Wed, 01 Apr 2015 11:15:33 -0500 Received: by lajy8 with SMTP id y8so40489638laj.0 for ; Wed, 01 Apr 2015 09:15:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=xqTcjjE3lS3ppc649noP2mzYpCjupkMEMKDbZnY8Iw8=; b=WJqUa/hjvaxMptlOd9B3HmUx5KEYrIYq62fCkZmAYw/ng4TNKNkuwvbv4grdj4TqxZ H3M5ic9pOSAY0dwI6anOvOAujnP9aOOR3rYFE0SFNJ7sKPdWsAoM4cmzFtGv/v6fhLVp Wbym05CHilH9C4Tw0DCnHTmPuecalzk7r257LeJBMmjO43AHMLJGrX2ue5hxymL8QFr/ VILW/YLKimbHlFBjMAlYViamkBpem+t7RCHFFOk2sLFT4GCN4LFSdPvjr805e6rowp0h 4hMI5jK65UhkdOEQFeJwAKy1x2oTpP4LgSuG9YaIdqVpqjvBmC7YbexNy0xk42CNN4ze mRzA== X-Gm-Message-State: ALoCoQm1fjNrf1FQ99lKODcjEmC05Jzo/pA/6IbjIg4tyC1bE8/wLi1fCGbEyhi2jI387XMbdyJE MIME-Version: 1.0 X-Received: by 10.112.140.38 with SMTP id rd6mr36214820lbb.116.1427904929110; Wed, 01 Apr 2015 09:15:29 -0700 (PDT) Received: by 10.25.87.202 with HTTP; Wed, 1 Apr 2015 09:15:29 -0700 (PDT) X-Originating-IP: [78.144.121.114] Date: Wed, 1 Apr 2015 16:15:29 +0000 Message-ID: To: "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Deprecate setlocale? From: danack@basereality.com (Dan Ackroyd) 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? ii) If it's not possible (or desirable) to remove it, how could we increase the warning level against using it? cheers Dan