Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120536 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 73212 invoked from network); 6 Jun 2023 18:20:18 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 6 Jun 2023 18:20:18 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A8649180382 for ; Tue, 6 Jun 2023 11:20:17 -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.7 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 6 Jun 2023 11:20:17 -0700 (PDT) Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-9741caaf9d4so950996266b.0 for ; Tue, 06 Jun 2023 11:20:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686075616; x=1688667616; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=VcozyjWV0EgEgJnj6/ohZX7N58Rof6VHVMyJtgHu2oc=; b=g4+YNhtVvZWgWOjqsU2XX1osPhGd6dJnpBcVXe1ihZC9tWjXQ2/d8wKmjIcbleavNL QkLu/CTIQKS4rCDORYfrFaMsd0PkDGAWe5MNPjMFxnX5xS5AbOSgVCSz9PSAmhXxwbwj Jc77S5jq7FfmvRJ5A/vpKy7xLKcAYVOVUewfGeFqi5DVExdXsNkd2ZesWt8EWBvGjEaj BHME5XHfWw8OAxBqH9R3QtEzjDACkrgFo5P4BU40nzSPKzFTryLPjbFKuyr3Xew9w8zu WfK2p4QaDNtkejqFrCC14HvrY7u5FKczDd9oDwL6JWm/QUbj9bL9VdyA0641ln/Bthw9 aE0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686075616; x=1688667616; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VcozyjWV0EgEgJnj6/ohZX7N58Rof6VHVMyJtgHu2oc=; b=FUZNJkSz9cxjO9ecfjQ5F5loLdGsxg4RGjl9QTDsUo2/RHeGHo4fPQkzRpv532Psa6 4WLH5lbyJu9OcC5hfB6flyN2LOeAdtwwC8rii2csZw/haB54f+qs/kN30afUXHkddA7c dhS5woGsToc7Rx97+CwhIqh+XROlV80fKD5wAE8/N3X5NsVcGr8ZGQgWU8qW/0cFKvUy jCZROFgCIa5Z5C1gvfUrM3jsZQO+ibCY2JFuvCMmSbJ3fttTdcRn0e1yq1TPcWgNG82f 4rQfTfDBhpl0cJdYP+fxBLjYoSJ6AL/HOVu1LdLkp1ZrUXDrvgDK61dSrcmoyJW5n0Kc K9aA== X-Gm-Message-State: AC+VfDwHfG0dnf5ayKNL/1o/2605f57AYTF1sXbJX5ujj6FAb91GdsRv dA31M/a8J0D+JpmTq4ehvPJ+UmK+P6o= X-Google-Smtp-Source: ACHHUZ4rHBkySfVeVTkNE//8ssYytITZHtqGZCobHXqK8EZuhy0nGCR3HRF3kIugnc0uo6xpGP9yQw== X-Received: by 2002:a17:907:d8a:b0:974:1839:11f2 with SMTP id go10-20020a1709070d8a00b00974183911f2mr4198069ejc.0.1686075615714; Tue, 06 Jun 2023 11:20:15 -0700 (PDT) Received: from ?IPV6:2a02:1811:cc83:eef0:7bf1:a0f8:a9aa:ac98? (ptr-dtfv0pmq82wc9dcpm6w.18120a2.ip6.access.telenet.be. [2a02:1811:cc83:eef0:7bf1:a0f8:a9aa:ac98]) by smtp.gmail.com with ESMTPSA id uz13-20020a170907118d00b009775eb0343bsm4726817ejb.79.2023.06.06.11.20.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 06 Jun 2023 11:20:15 -0700 (PDT) Message-ID: <96a69724-32d4-a3d6-d543-3020a90360db@gmail.com> Date: Tue, 6 Jun 2023 20:20:14 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Content-Language: en-US To: Christian Schneider , PHP internals References: <646e0eee-b9e4-58bf-d118-3e5c7fa2ae52@gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] [VOTE] mb_str_pad From: dossche.niels@gmail.com (Niels Dossche) Hi Christian On 06/06/2023 09:12, Christian Schneider wrote: > Am 05.06.2023 um 19:59 schrieb Niels Dossche : >> I'm opening the vote now on my proposal to include mb_str_pad() into PHP 8.3. >> RFC link: https://wiki.php.net/rfc/mb_str_pad > > I voted "No" because I think it should be grapheme_str_pad instead and I'd like to avoid having both the mb_ and grapheme_ versions which unnecessarily confuses users. > > I guess I should have spoken up before but I couldn't think of a use case for padding characters instead of graphemes. Or am I missing something? > > - Chris > Thanks for explaining, I appreciate that. String padding is naturally often associated with display. The use-cases I had in mind are rather more related to data formats, protocols and/or standards. Although a lot of users who hand-rolled their own mb_str_pad misuse it for display purposes, there are use-cases that do indeed use it for the purposes I described above. Some random examples I found using GH code search: * https://github.com/WPPlugins/estonian-banklinks-for-woocommerce/blob/5f97891cfb43d9bde6017243998a3ab424f43b93/includes/gateways/class-wc-banklink-estcard-gateway.php#L139 * https://github.com/ExaByt3s/fodyo/blob/eefdec7da76c820e90987b32baf2aef5ea8d6ca2/bitrix/modules/sale/lib/tradingplatform/vk/feed/data/converters/product.php#L179 * https://github.com/mbence/csaladsegito/blob/20e639b1865ac2ba6be8fc64f69ba9e6f474ef0f/src/JCSGYK/AdminBundle/Services/ClosingService.php#L381 I heard the grapheme argument two times before, one time on the list and one time on Reddit. I do think it's primarily a documentation problem. One problem may be though that a non-negligible number of users probably don't read documentation. The fact that this comes up again gives me a little bit of fear whether the function would cause confusion. So I'm keeping my ears open for concerns. For visual purposes I'm also not sure if a grapheme variant would fully suffice, as it would also require the grapheme to be fixed width. But that's another issue of course. Kind regards Niels