Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117413 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 97571 invoked from network); 24 Mar 2022 09:52:31 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 24 Mar 2022 09:52:31 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5A1BC18053D for ; Thu, 24 Mar 2022 04:19:29 -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=-0.2 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (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 ; Thu, 24 Mar 2022 04:19:28 -0700 (PDT) Received: by mail-wr1-f52.google.com with SMTP id h4so6114155wrc.13 for ; Thu, 24 Mar 2022 04:19:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to:content-transfer-encoding; bh=uPKFx0qolZ2cYIFeTeCi8edO+flEM0mjc6KCvHCaLTs=; b=PzB2QIto9y90sTcJRQXJOuC7Ux1CGWHcoSGL1GdCTfnBlw8VPQ/NfiakqFOagPIaOD jVKdnrNjznkkXYGXZmVWQ5OD9+NWbD6K4UDwkbaDPvc1PUbfiM2bxs3FW+zZGfdHWqrm c6eWb7p676YilGPc/RUJ4jtbBcB3KKHDhmq1huNuEk4TL7P/X+y78P6xH0SW7H0OkOZq CXf3phPp9X3l4kZd4RjVsS3fHIt5fawSrvogeTPMcB6qmcYS3XRxtt/suP+MsYhtBOwi 3XaTGHBfn0rMdCXstcu0XxYC/ShcUWoF15sPK8VLxM67P6UDOSdfnyrCL06mr2C2Kp5s lylA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=uPKFx0qolZ2cYIFeTeCi8edO+flEM0mjc6KCvHCaLTs=; b=rLrZOPtcRsk5ytkZ43vu6wLma4zaqsSwIN+nCVD/iUc9Uegb+4qeMy6fZEG+GENxgK y/Cmy8SsgNbAbXCeTRRi+HlH6+0kTRosZvtBlHgn3yvYnu8sGIpFJ/Wsa5OIqpQgkwNM uaUWBpex1Rtmdxg3gPswawgdIc4M4qDggcwBBEmbAp0I7L+4V9PmuQeE+nijCFfgTcTG 31aQpUbhxcJkVuosthgQY6aUGlgwdGxf0DPApKVPCx/lTrhTBsVRGughL0ERlGOqyyhx INTRwq2qVA7R8xOPPltB9LBJV2R0N4MdGyv7/eLH8QhXwOFotujwcxJRwKfnsBpbzrlM K9nQ== X-Gm-Message-State: AOAM530W+Fag523+8pYCIPI/A0rlnDARgG5TTITBT4dyWi+bownzlsaR whI8/amiV79/rNQt95lMIMVIf84JlUQ= X-Google-Smtp-Source: ABdhPJwq1/j1FYUGnZO+Ytj3foy+t9reG2DK4adNbqr6GTvxuvIgiHSCXiH8ZKLDObqXowncLNnt3w== X-Received: by 2002:a5d:6485:0:b0:204:1643:ad45 with SMTP id o5-20020a5d6485000000b002041643ad45mr4189322wri.450.1648120767518; Thu, 24 Mar 2022 04:19:27 -0700 (PDT) Received: from [192.168.0.22] (cpc104104-brig22-2-0-cust548.3-3.cable.virginm.net. [82.10.58.37]) by smtp.googlemail.com with ESMTPSA id a18-20020a05600c349200b0038ca453a887sm6031003wmq.19.2022.03.24.04.19.26 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Mar 2022 04:19:27 -0700 (PDT) Message-ID: Date: Thu, 24 Mar 2022 11:19:25 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Content-Language: en-GB To: internals@lists.php.net References: <22242169-a16d-5261-696c-3cf00b00336a@gmail.com> <0b322a3e-469a-7ed7-16e3-0b76287f4091@gmail.com> <623BAFB6.4000901@adviesenzo.nl> <19112CBA-7BA7-4AA8-95BF-76EE20ECE56C@cschneid.com> In-Reply-To: <19112CBA-7BA7-4AA8-95BF-76EE20ECE56C@cschneid.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [RFC] Deprecate and Remove utf8_encode and utf8_decode From: rowan.collins@gmail.com (Rowan Tommins) On 24/03/2022 09:52, Christian Schneider wrote: >> If these functions were proposed today, under better names but the same feature set, I don't think mbstring being optional would be accepted as reasoning for adding them to core. So the only reason to keep them is if they're widely (and successfully) used, which I've not found evidence for. > This argument is somewhat broken: Not adding something because an alternative exists is not the same as removing something (requiring code changes) where an alternative exists. Absolutely, and an earlier draft of my e-mail said that more explicitly, but I edited for conciseness. I was trying to make the distinction that we wouldn't want to tell new users "if you want to measure the length of the string, install ext/strlen"; but telling new users "if you want to convert encodings, install ext/mbstring" is probably reasonable. You are absolutely right that that does *not* apply to *existing* uses of the functions, and there will be some proportion of users / libraries who were previously using these functions successfully, but do not have mbstring installed / required. I think the usage is low enough, and the install base of mbstring is high enough, that that won't affect many people; but it's hard to prove that conclusively. In the end, we have to weigh two costs: the cost to *new* users of leaving these confusing functions in place; and the cost to some portion of *existing* users of forcing them to change their code, and possibly install ext-mbstring (or some alternative). Doing nothing is not automatically better. > I have one issue with the wording in the RFC: While “Function utf8_encode is deprecated; check usage is correct and consider mb_convert_encoding or other replacement.” suggests to replace it, the part about checking the usage implies that if someone is sure about the correct usage it is fine to keep using utf8_encode(). But as the proposal wants to remove it for 9.0 I think this is somewhat misleading. That's a fair point. The intention was to encourage people to look at whether they were using the function right in the first place, not blindly replace it with mb_convert_encoding, since the whole point of the deprecation is that they probably aren't. I'm not sure how to concisely say "replace with mb_convert_encoding if you actually need to, but maybe you can just delete this function call and your code will be better". Regards, -- Rowan Tommins [IMSoP]