From 2a55f52df2320a9f5509e1cf7c9bfa0299230aee Mon Sep 17 00:00:00 2001 From: BePsvPT Date: Sun, 10 Jan 2016 03:58:00 +0800 Subject: [PATCH] Fix mb_substr third param to support php 5.3 --- src/Faker/Provider/zh_TW/Text.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Faker/Provider/zh_TW/Text.php b/src/Faker/Provider/zh_TW/Text.php index 3521f7a485..b442481382 100644 --- a/src/Faker/Provider/zh_TW/Text.php +++ b/src/Faker/Provider/zh_TW/Text.php @@ -129,7 +129,9 @@ protected static function appendEnd($text) // extract the last char of $text if ($mbAvailable) { - $last = mb_substr($text, mb_strlen($text, static::$encoding) - 1, null, static::$encoding); + // in order to support php 5.3, third param use 1 instead of null + // https://secure.php.net/manual/en/function.mb-substr.php#refsect1-function.mb-substr-changelog + $last = mb_substr($text, mb_strlen($text, static::$encoding) - 1, 1, static::$encoding); } else { $chars = static::utf8Encoding($text); $last = $chars[count($chars) - 1];