Re: [RFC] Deprecations for PHP 8.4

From: Date: Thu, 27 Jun 2024 17:09:33 +0000
Subject: Re: [RFC] Deprecations for PHP 8.4
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
> On Jun 27, 2024, at 2:22 AM, Stephen Reay <[email protected]> wrote:
>
> I do appreciate that strtok has a kind of bizarre signature/use pattern and potential for
> confusion due to how subsequent calls work, but to me that sounds like a better result for uses that
> need the repeated call functionality, would be to introduce a builtin StringTokenizer
> class that wraps the underlying strtok_r C call and uses internal state to keep track of the string
> being tokenized.

strtok is weird, but it’s not actually dangerous. An OO wrapper doesn’t sound worth it unless it
comes with compelling extra features or at least a reusable abstraction in the form of a concrete
StrTokTokenizer (or hopefully a less ugly name) implementing a StringTokenizer
interface.

Personally I say let strtok be and just admit in the documentation that it’s weird because C.

[Resent to the list. Sorry for any previously cc'd dups, macOS Mail keeps guessing the wrong
sender address.]
—c (weird just because)


Thread (68 messages)