#57712 closed enhancement (fixed)
Suggestion for code comment in sanitize_user()
Reported by: | ace100 | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 6.2 | Priority: | normal |
Severity: | minor | Version: | |
Component: | Users | Keywords: | good-first-bug has-patch |
Focuses: | docs | Cc: |
Description
I spent a long time trying to understand the following comment and code at https://developer.wordpress.org/reference/functions/sanitize_user/:
// Kill octets. $username = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '', $username );
I think it would be better if the comment was "remove percent-encoded characters".
Change History (5)
#1
@
19 months ago
- Focuses docs added
- Keywords needs-patch good-first-bug added
- Milestone changed from Awaiting Review to 6.2
This ticket was mentioned in PR #4078 on WordPress/wordpress-develop by @tanjimtc71.
19 months ago
#2
- Keywords has-patch added; needs-patch removed
Hi there!
I've made some changes to the sanitize_user()
function to clarify the use of special characters in the comment. Specifically, I updated the comment to reflect that the function removes HTML entities and percent-encoded characters, rather than "killing" them.
Please review my changes and let me know if there are any issues or further improvements that need to be made. Thanks for your help!
Fixes #57712.
Trac ticket: https://core.trac.wordpress.org/ticket/57712
#4
@
19 months ago
- Owner set to SergeyBiryukov
- Resolution set to fixed
- Status changed from new to closed
In 55346:
@SergeyBiryukov commented on PR #4078:
19 months ago
#5
Thanks for the PR! Merged in r55346 as part of a few other similar edits.
Hi there, welcome to WordPress Trac! Thanks for the ticket.
Yes, that sounds like a better comment. Would you be interested in creating a patch?
Additionally, the "Kill entities" comment directly below can probably be replaced with "Remove HTML entities".
Moving to 6.2, as this only affects code comments and can still be committed in beta.