Re: [RFC] Prepared Literal String Matching and Replacement
| From: | Tim Düsterhus | Date: | Mon, 23 Nov 2026 23:10:41 +0000 |
| Subject: | Re: [RFC] Prepared Literal String Matching and Replacement | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-133215@lists.php.net to get a copy of this message | ||
Hi
On 2026-11-23 23:52, Andrew F wrote:
Yes. I acknowledge that myself in the *literal sentence* that follows after the part you quoted. My point about “this is a specific type of matching that is being performed by those classes” stands though, and I believe the classes should be renamed. Best regards Tim DüsterhusThe unqualified names of the three classes are also awfully generic and potentially preclude future extensions: There clearly are more possible ways of “matching strings” than a scan for (sub)string literals. The new stdlib APIs that we've introduced lately clearly specify the “algorithm” or standard they implement in the name (e.g.I have to disagree with this bit, though. The fundamental functionality which these methods provide is string matching and replacement. The use of Aho-Corasick to implement this is an implementation detail which users should not need to be concerned with, and which PHP should be able to change if a better implementation is found. (By way of example: the standard sorting function is called sort(), not quicksort().)Random\Engine\Xoshiro256StarStarorUri\Rfc3986\Uri).