Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85700 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28647 invoked from network); 2 Apr 2015 22:10:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Apr 2015 22:10:43 -0000 Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain lerdorf.com designates 209.85.192.170 as permitted sender) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 209.85.192.170 mail-pd0-f170.google.com Received: from [209.85.192.170] ([209.85.192.170:34257] helo=mail-pd0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 95/9B-56257-16EBD155 for ; Thu, 02 Apr 2015 17:10:43 -0500 Received: by pdbni2 with SMTP id ni2so102209081pdb.1 for ; Thu, 02 Apr 2015 15:10:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type; bh=frmkexaguYp/3GBhoDzAV5H+vcEXIcmbgbh9SIIlrYI=; b=kt2d9QIpCJBwv1V1JLHt4MmIyVrrDZkLmovWaAi6bOLFIRVtzON0CCqcSM4UlrzPfn G/IWj/FXQTgrfQqJ1OxVvKWnLm2ca4j8/xzcMdixCYNXqAJxj/ddsAV1WtKi9JPjvstg pGe5uws69pSD+mhzphrZiKtlQUUswZh5D/ULodpUBNQYltuVdXViMjJzP+vbiLb4u/9W jDAeJO592djFnMn1x0Rd1kOLty0kNf2E8MNZpj5h1w91faS2De/SDeFHrznYGRqe2OCQ IHqasdrxFgkIml6M71CLT0hadNv7mKcBQxv9pQfYDFV8UBur+u5pxYKVM8yINCp8LskN CamQ== X-Gm-Message-State: ALoCoQk6K+wqvuDsNY9NN9uxRUBY88Dfnat8kfuhEMyOHojlltZk601BmeZYDn9kKru58yM5NBIX X-Received: by 10.68.189.225 with SMTP id gl1mr89076646pbc.91.1428012638708; Thu, 02 Apr 2015 15:10:38 -0700 (PDT) Received: from [192.168.200.14] (c-50-131-44-225.hsd1.ca.comcast.net. [50.131.44.225]) by mx.google.com with ESMTPSA id ic7sm4549898pbc.70.2015.04.02.15.10.36 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Apr 2015 15:10:37 -0700 (PDT) Message-ID: <551DBE5C.8040402@lerdorf.com> Date: Thu, 02 Apr 2015 15:10:36 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Dan Ackroyd , Ryan Pallas CC: Adam Harvey , Keyur Govande , "internals@lists.php.net" References: <551CEDF6.7090408@lerdorf.com> In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="doAaWI781ScF2mLpoRd2XldUmmexcUHej" Subject: Re: [PHP-DEV] Deprecate setlocale? From: rasmus@lerdorf.com (Rasmus Lerdorf) --doAaWI781ScF2mLpoRd2XldUmmexcUHej Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 04/02/2015 02:13 PM, Dan Ackroyd wrote: > Adam Harvey wrote: >> What about just adding another function: setlocale_global(), or simila= r? >=20 > Do you mean setlocale would become the thread safe one, and > setlocale_global() would be the current behaviour? If so, that would > be a BC break for the small number of people who are deliberately > using setlocale globally. We could do that at a major version I guess. >=20 > I think the ini setting is still better - it allows people to use code > that was written assuming that setlocale was safe to use, rather than > forcing them to change it. >=20 > It might be best to introduce both setlocale_ts() and > setlocale_global(), so that users could call either explicitly, and > have the ini setting control which one setlocale() points to. If we > did that we could also then plan to eventually deprecate both the ini > setting and the plain setlocale without _ts/_global. >=20 > Ryan Pallas wrote: >> I like the idea of an INI actually, but I would make it default to the= current behaviour and user education so those who need TS know to change= it. >=20 > The problem with that is that for people who aren't aware of the > setting, they wouldn't know that they need to change the setting. > Instead they just want their code to work properly 'out of the box'. > For the vast majority of people calling the thread safe version of > setlocale would be what they problem want it to do, and so PHP should > default to the right thing for the majority of people. >=20 > Of course there is a separate argument about changing the behaviour at > major/minor version, and if this was introduced then having to > `thread_safe_setlocale=3Doff` for 7.1 and `thread_safe_setlocale=3Don` = for > 8 could be correct. A step back here, please. Which concrete problem are you actually trying to solve? HHVM needed this fix because of its single-process threaded architecture on UNIX. PHP is not typically threaded on UNIX, so it doesn't seem like an issue affecting very many people. It has been on our radar for ages and has a big prominent red warning box about it in the documentation. Threaded use of PHP on UNIX tends to be rather specialized cases by people who understand that things like setlocale() and putenv() are process-wide. That doesn't mean there is anything wrong with implementing thread-local setlocale for our threadsafe builds, and we should definitely fix any in-process setlocale interference issues, but the thread safety part of it just doesn't seem like something very many people are going to care about. Why do you? -Rasmus --doAaWI781ScF2mLpoRd2XldUmmexcUHej Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlUdvlwACgkQlxayKTuqOuDh8wCggZO/Ih/0WTFyrX5K2721IL1C 9MsAn0cRIBHr7KtvKdpG/++Rr4gWIG1g =NCZC -----END PGP SIGNATURE----- --doAaWI781ScF2mLpoRd2XldUmmexcUHej--