Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#11573 closed defect (bug) (fixed)

sanitize_text_field() leaves extra whitespace when stripping octets

Reported by: westi Owned by: westi
Milestone: 3.0 Priority: normal
Severity: normal Version: 2.9
Component: Formatting Keywords:
Focuses: Cc:


If you sanitize out some octets from a string like:

We also %AB remove %ab octets

You get: We also__remove__octets

Instead of : We also_remove_octets

Found this while writing test cases for this based on the report in #11528

Attachments (1)

11573.patch (785 bytes) - added by azaozz 6 years ago.

Download all attachments as: .zip

Change History (5)

#1 @westi
6 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [12503]) Improve sanitize_text_field() some more so that we don't leave extra whitespace after stripping octets. Fixes #11573.

6 years ago

#2 @azaozz
6 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

It's not often that there are octets in these strings. Perhaps we can save a little bit by running the last regex only when needed.

#3 @westi
6 years ago

That looks like a better idea.

And stripping only spaces the second time round looks like a good idea too.

#4 @westi
6 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [12504]) Only run a second spaces strip if we replaced some octets. Also only replace spaces and we have already removed the other whitespace chars. Fixes #11573 props azaozz.

Note: See TracTickets for help on using tickets.