Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#32190 closed defect (bug) (fixed)

mb_strlen doesn't account for encoding

Reported by: kraftbj's profile kraftbj Owned by:
Milestone: 4.2.2 Priority: normal
Severity: normal Version: 4.2
Component: General Keywords:
Focuses: Cc:

Description

In [32114], a mb_strlen function was added that only accounts for UTF-8 with a note that if you need other encoding to use regular strlen.

Plugins may already been using mb_strlen primarily with a different encoding that results in unexpected behavior when the compat function fires.

Case in point: WP Super Cache uses Gzip compression as an option to deliver cached files and uses mb_strlen($data, '8bit') when function_exists to determine the length for the headers. With 4.2, sites lacking native mb_strlen return 0, breaking delivery. With WPSC, if mb_strlen was not present, then defaulted back to strlen.

Ideas: If an unsupported encoding is passed, return strlen instead?

WPSC tracker: https://github.com/Automattic/wp-super-cache/issues/32

Change History (2)

#1 @kraftbj
9 years ago

  • Keywords close added

I believe this was resolved by r32364 in trunk and r32367 in the 4.2-branch. Can someone with super powers mark as fixed?

#2 @DrewAPicture
9 years ago

  • Keywords close removed
  • Milestone changed from Awaiting Review to 4.2.2
  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.