[wp-trac] [WordPress Trac] #44958: &nbsp character in title generates a permalink (and slug) with space

WordPress Trac noreply at wordpress.org
Wed Oct 11 23:17:11 UTC 2023


#44958: &nbsp character in title generates a permalink (and slug) with space
-------------------------------------------------+-------------------------
 Reporter:  ace2_heart                           |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:  6.5
Component:  Permalinks                           |     Version:  4.8
 Severity:  major                                |  Resolution:
 Keywords:  needs-testing has-patch has-         |     Focuses:
  testing-info has-screenshots                   |
-------------------------------------------------+-------------------------

Comment (by dmsnell):

 After some additional testing I was unable to reproduce through the block
 editor, but when attempting to paste some of these characters into the
 title field, another bug appeared, which I'll file in the Gutenberg
 repository (the contents of the title duplicate).

 With the Classic Editor plugin I was able to reproduce, and I assume that
 API calls and manual calls from within PHP would have similarly exhibited
 the broken behavior.

 In deeper review of this patch I do think it's worth taking out the "also
 %e280 to be on the safe side," though on a second thought it's not
 unrealistic to keep it in there, but for the different reason that "%e280"
 only appears when something else is already broken. This is more about the
 question of whether we want to make a bad situation potentially worse or
 leave it only as bad as it is; I generally find that leaving broken things
 the way they are leads to less confusion and corruption.

 ---

 If we want to explore the broader issue for 6.5 I will volunteer my time
 to look into it, as the function is already fairly ad-hoc and this
 particular ticket seems part of the broader problem that we're hitting
 specific cases instead of taking a systematic or formal approach in
 handling the slug creation.

 I've started exploring a PCRE-based approach in
 https://github.com/WordPress/wordpress-develop/pull/5466 that relies on
 Unicode character classes. If that approach works, it could simplify the
 function while boosting its reliability and maintainability. There are
 thankfully a fair number of unit tests and there's a fair bit of work to
 do there, but it seems tractable that we could collect a lot of currently-
 scattered logic and cover many bases in one go.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44958#comment:26>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list