Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114966 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 53277 invoked from network); 18 Jun 2021 20:59:32 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 18 Jun 2021 20:59:32 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 725D41804C0 for ; Fri, 18 Jun 2021 14:16:52 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_NEUTRAL autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from xdebug.org (xdebug.org [82.113.146.227]) by php-smtp4.php.net (Postfix) with ESMTP for ; Fri, 18 Jun 2021 14:16:51 -0700 (PDT) Received: from [192.168.42.60] (host81-159-84-188.range81-159.btcentralplus.com [81.159.84.188]) by xdebug.org (Postfix) with ESMTPSA id ACBA410C030; Fri, 18 Jun 2021 22:16:50 +0100 (BST) Date: Fri, 18 Jun 2021 22:16:49 +0100 User-Agent: K-9 Mail for Android In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable To: internals@lists.php.net,Rowan Tommins Message-ID: <4D4B548F-5F51-480B-AECF-FC2DB586F396@php.net> Subject: Re: [PHP-DEV] Re: [RFC] Deprecations for PHP 8.1 From: derick@php.net (Derick Rethans) On 18 June 2021 19:33:09 BST, Rowan Tommins w= rote: >On 15/06/2021 11:53, Nikita Popov wrote: >> Feedback on the proposed deprecations is appreciated=2E Personally, the >two >> I'm unsure about are "get_class(), get_parent_class() and >> get_called_class() without argument" which are mostly stylistic in >nature, >> and "strftime() and gmtstrftime()", where the non-portability issues >are >> possibly not so bad that a disruption of existing users is >worthwhile=2E > > >To add some more "anecdata" to this, I just ran this to check for most=20 >of the mentioned functions against the code base I work on (~800k lines > >of PHP, the oldest dating from 2002): > >ack --php=20 >'date_sunrise|date_sunset|mb_check_encoding\(\)|get_class\(\)|get_parent_= class\(\)|get_called_class\(\)|FILE_BINARY|FILE_TEXT|strptime|strftime|gmts= trftime|mhash|mysqli::init|filter=2Edefault|auto_detect_line_endings|ssl_me= thod|FILTER_SANITIZE_STRING|FILTER_SANITIZE_STRIPPED|oci8=2Eold_oci_close_s= emantics|odbc_result_all' > >-oh | sort | uniq -c > > >The result is this: > >1 FILTER_SANITIZE_STRING (which definitely looks dubious) >1 auto_detect_line_endings (which is commented out anyway) >276 strftime (nearly half are using the format string "%B" to get a=20 >translated month name, the others are using various "human-friendly"=20 >localized strings) > >Running the same command on the vendor directory, I find a further use=20 >of strftime (in nusoap, which should probably just be using date()) and > >a handful of uses of get_class() and get_called_class() (which I >haven't=20 >looked at it in detail)=2E > > >If it went to a vote now, I would vote "no" on strftime: > >* Looking at the proposed replacement, IntlDateFormatter, the API seems > >to be much more complex and completely incompatible, so migration would > >be painful=2E >* The codebase never needs to run on Windows, so portability is=20 >completely irrelevant to me=2E >* There is a note on the manual page for setlocale() warning that it is > >not thread-safe, which if true would be a stronger reason to deprecate=20 >strftime() and friends, IF there was a simple thread-safe replacement=2E= =20 >However, that's not mentioned in the RFC, and I'm not clear if it's=20 >actually still the case=2E > > >Regards, strftime is infected by thread unsafe locales, which is plenty of reason t= o deprecate it, with additional pro reasons for doing so being its disparat= e functionality among different os-es and libc's=2E Deprecation also doesn't mean removal, which won't happen until PHP 9, giv= ing developers plenty of time to move to a saner threadsafe locale API base= d on intl/icu=2E cheers Derick