Skip to content

Commit f337c92

Browse files
committed
Test mb_strlen for all text encodings supported by mbstring
When combining all the CJK encoding conversion code in a single file, I combined some redundant mblen tables. This check will help to ensure that all the mblen tables are correct.
1 parent 245daed commit f337c92

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ext/mbstring/tests/encoding_tests.inc

+6
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,12 @@ function testAllValidChars($charMap, $fromEncoding, $toEncoding, $bothWays = tru
148148
}
149149

150150
testValidString($fromString, $toString, $fromEncoding, $toEncoding, $bothWays);
151+
152+
$strLen = mb_strlen($fromString, $fromEncoding);
153+
if ($strLen !== mb_strlen($toString, $toEncoding)) {
154+
echo "Length of $fromEncoding string '" . bin2hex($fromString) . "' was different than expected; mb_strlen returned $strLen" . PHP_EOL;
155+
testFailedIncrement();
156+
}
151157
}
152158
}
153159

0 commit comments

Comments
 (0)