Opened 9 years ago
Closed 9 years ago
#32190 closed defect (bug) (fixed)
mb_strlen doesn't account for encoding
Reported by: | 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
I believe this was resolved by r32364 in trunk and r32367 in the 4.2-branch. Can someone with super powers mark as fixed?