Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115173 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 86059 invoked from network); 28 Jun 2021 14:05:57 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 28 Jun 2021 14:05:57 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C39851804C3 for ; Mon, 28 Jun 2021 07:25:43 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 28 Jun 2021 07:25:43 -0700 (PDT) Received: by mail-lf1-f50.google.com with SMTP id a11so32875489lfg.11 for ; Mon, 28 Jun 2021 07:25:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=E7wrDl7i3A5FfJel8xb4smIyBYpmmZINMbOkv4U6HOs=; b=IL+RhKLqEa+ikBX3w/EyzmP0BaDHLIUpKKDRDsk1H2FbczjyOFAMGtYsbSno7VxZDZ HTGjoAeqGPh3UJerF8tnsSDukVS3ypvz/5Jxoq0m38PoVQ7aE3FfwwhpqU7j/5/Py7Mn AheKkuE5HwmJP3bGIRriBLa5wjUWAwVzg5Kc96JLNOuLReoGR941UEA8Q1nyJYZVcUut ZlKsYwq4Nx6KtK8as+GW+DLDxSOwaIfYhQ8ZvHtBEsqpKOKQARdZxXjX6ek//CdXxS2R OFFu86jjftRWlOZWPnNvgw9pIo3wVI7eCdjhw+WW9nlUOidnOtV6/ALZ0fmtCfeyJxme yOGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=E7wrDl7i3A5FfJel8xb4smIyBYpmmZINMbOkv4U6HOs=; b=nuQdfjz7dxtGsTYE9qwGH6B2VovUBepdyHSps7X1LMkdU89aHmXkuMDsPnfqe3GiYk LT2LNQxE05dF8gkJGtohuv3vBCYzSE1MlRebNxdFBm3qfO6+O+zCTsdh+VnmVSn627S0 lKLIXKxPgSXL0chro6zkveOjcQNOxGaqPsIUliOLxz36hUcPN8HtaErHDSkJnZ3+/F0w pG1bx/UR0u63kiWh2Nm9vTLhoY07NK+TVV3ccTDAv1Sil4I/syOtaqb0slkSZF5rAUkq ffB2lpzGBH4boaCfl4DOK7e3rXUW4tfnLoE2y5rmX7ant9lCnsJShmw8J7MltWl4VOVX Y9yw== X-Gm-Message-State: AOAM532blitYKtwGt9ufvIdWHwNosGYRvaN6l5L2c95ZcWfyxR0QilEo FLnx3QFzFSvKJ/Wi0ck/350NJASGnxvGSha8Ukw= X-Google-Smtp-Source: ABdhPJx2qg5LrVre6HZ3YCtzYg/xDHrP/3yPrfha6P9nmfRj2sfjFmmpS/gfIe8/iBjxFbHBFcjY3JOg3HfAzbJx4OI= X-Received: by 2002:a05:6512:32c9:: with SMTP id f9mr14825322lfg.638.1624890339858; Mon, 28 Jun 2021 07:25:39 -0700 (PDT) MIME-Version: 1.0 References: <4D4B548F-5F51-480B-AECF-FC2DB586F396@php.net> In-Reply-To: Date: Mon, 28 Jun 2021 16:25:24 +0200 Message-ID: To: Rowan Tommins Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000819e0f05c5d44381" Subject: Re: [PHP-DEV] Re: [RFC] Deprecations for PHP 8.1 From: nikita.ppv@gmail.com (Nikita Popov) --000000000000819e0f05c5d44381 Content-Type: text/plain; charset="UTF-8" On Sat, Jun 19, 2021 at 1:04 AM Rowan Tommins wrote: > On 18/06/2021 22:16, Derick Rethans wrote: > > strftime is infected by thread unsafe locales, which is plenty of reason > to deprecate it, with additional pro reasons for doing so being its > disparate functionality among different os-es and libc's. > > > > Deprecation also doesn't mean removal, which won't happen until PHP 9, > giving developers plenty of time to move to a saner threadsafe locale API > based on intl/icu. > > > I think you're probably right, but I think in general deprecations > should be accompanied by much stronger migration instructions than > "there's a class over here that probably does what you want if you kick > it a bit". > > Like everything in ext/intl, IntlDateFormatter is rather complex, and > the manual relies heavily on links to the ICU documentation, some of > which are 404s. If you're saying my 276 uses of strftime() are "wrong", > it would be nice to have a clear message of what is "right", and what I > should do to "fix" them. > Yeah, I definitely see the concern here. In my corpus, most uses of strftime() are actually locale-independent and can be easily replaced by DateTime::format(). I guess these are only being used because calling strftime() is slightly more compact than calling DateTime::format(), which requires creating a DateTime object first. A small handful use a locale sensitive format, which would require IntlDateFormatter and its more complex API. I believe the equivalent for %B would be something like this: https://3v4l.org/1pNDi It doesn't help that the IntlDateFormatter API is un-great and doesn't allow you to directly create a formatter for a pattern without passing a number of irrelevant arguments. Regards, Nikita PS: I found this scary comment in the strftime() docs: https://www.php.net/manual/en/function.strftime.php#104043 --000000000000819e0f05c5d44381--