#64089 closed defect (bug) (fixed)
Post titles containing non-breaking hyphens are not sanitized
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 6.9 | Priority: | normal |
| Severity: | trivial | Version: | 4.5 |
| Component: | Formatting | Keywords: | has-patch has-unit-tests |
| Focuses: | Cc: |
Description
The sanitize_title_with_dashes function is lacking sanitization of non-breaking hyphens.
Attachments (1)
Change History (11)
This ticket was mentioned in PR #10204 on WordPress/wordpress-develop by @patpiwo.
4 weeks ago
#1
#2
follow-up:
↓ 5
@
4 weeks ago
- Keywords needs-unit-tests added
- Milestone changed from Awaiting Review to 6.9
Thanks for opening this and for the PR!
I'm curious how you encountered this issue? Would there be other hyphen-like characters which would be suitable for turning into hyphens?
@westonruter commented on PR #10204:
2 weeks ago
#3
@ppiwo Could you also add test cases for this as part of https://github.com/WordPress/wordpress-develop/blob/trunk/tests/phpunit/tests/formatting/sanitizeTitleWithDashes.php ?
#5
in reply to:
↑ 2
@
2 weeks ago
Replying to westonruter:
Thanks for opening this and for the PR!
I'm curious how you encountered this issue? Would there be other hyphen-like characters which would be suitable for turning into hyphens?
Thanks for your quick feedback!
I encountered the issue when a user used the non-breaking hyphen in their post title. The non-breaking hyphen was used within a hyphenated product name which I assume they didn't want broken between lines. I'm guessing they copied it from some sort of marketing material but I'm not really sure.
As far as other hyphens go, I don't know if I have the knowlege to answer that question. I see 13 different characters listed under dash punctuation and I'm hesitant to broaden the scope of this fix unecessarily without knowing which dashes are common enough to be covered. If you have insight into this feel free to suggest or make any changes.
@westonruter commented on PR #10204:
2 weeks ago
#6
I wanted to take this as an opportunity to improve maintenance of this going forward so I've added ff2d2a7. This is begging for a review from @dmsnell!
#7
@
2 weeks ago
- Keywords has-unit-tests added; needs-unit-tests removed
- Version changed from trunk to 4.5
@westonruter commented on PR #10204:
13 days ago
#10
Committed in r61061
Adds URL-encoded non-breaking hyphen () to the list of characters converted to regular hyphens in sanitize_title_with_dashes()
Fixes ticket #64089
Trac ticket: