-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Ban strtok() from the codebase #57542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
If the function is not deprecated, I'd prefer to do this change on 7.2 tbh. Do you know when this will be voted on? |
Note that we only use this function in the stateless way. |
The debate looks particularly heated, I guess it could take some time before the vote being triggered |
yes but no: the function still keeps the string in memory in case the stateful API is used, there is no way around (except maybe calling strtok again with the empty string after calling it...) |
In ~2 weeks: 8.4 freezes on August 13th |
Considering how often PHP deprecates a function and then undeprecates it in later releases may it would be worth while waiting until the next release? |
We don't really need php-src's lead here. The statefulness of the function is enough to ban it. |
This PR was merged into the 7.2 branch. Discussion ---------- [Lock][Process] Replace `strtok` calls | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | #57542 | License | MIT I targeted 5.4, I think this is a good thing in order to be future-proof and help potential fixes upmerges, strtok being deprecated or not. Rebasing on 7.2 is not a big deal though if needed, as I only found 1 more occurrence on the latest branch. Commits ------- c76ba0d [Lock][Process] Replace `strtok` calls
strtok() is considered for deprecation in https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_strtok_function
whether or not this it accepted, we shouldn't use this function, for the same reasons that it might be considered: this is a stateful function.
We should do this on branch 5.4, same as we do when fixing php-src deprecations.
The text was updated successfully, but these errors were encountered: