Re: [rfc] str_mask function
| From: | سپهر محمودی | Date: | Sat, 19 Sep 2026 09:20:18 +0000 |
| Subject: | Re: [rfc] str_mask function | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-132552@lists.php.net to get a copy of this message | ||
در تاریخ شنبه ۱۹ سپتامبر ۲۰۲۶، ۰۶:۴۸ Jordi Kroon
<jordikroon@me.com> نوشت:
> On 18 Sep 2026 at 18:43 -0400, Casper Langemeijer <langemeijer@php.net>,
> wrote:
>
>
> Not useful.
> Easily implemented in user-space.
> Performance would never be an issue for a function typically used on small
> strings a few times per request.
>
> In the multi-million-line web application I work on this probably would
> not be used even once.
>
> Greetings, Casper
>
> This. I don’t see any reason why this should added. Its use-case is quite
> a niche, which can be easily solved by calling substr_replace together with
> str_repeat.
>
> If you want to go on with your idea, the string parameter of this function
> should have the SensitiveParameter attribute or else it may end up in a
> backtrace.
>
> Regards,
> Jordi
>
---------
Hi Jordi,
Thank you for the review. That is a very good point — I have added the
#[\SensitiveParameter] attribute to the string parameter so masked values
will no longer appear in backtraces. The change is pushed to the PR.
I understand the use-case may look niche, but I will share benchmark data
in the coming days that addresses the performance aspects raised in this
thread.
Best regards,
Sepehr