From 6eeae0b5516ba2289053edceb69af0f73a851e3f Mon Sep 17 00:00:00 2001 From: hejunwei Date: Tue, 6 Sep 2016 16:20:15 +0800 Subject: [PATCH 1/2] fix mb_substr missing parameter error when generating japanese string with realText method --- src/Faker/Provider/ja_JP/Text.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Faker/Provider/ja_JP/Text.php b/src/Faker/Provider/ja_JP/Text.php index 33da229d4b..b83bfde282 100644 --- a/src/Faker/Provider/ja_JP/Text.php +++ b/src/Faker/Provider/ja_JP/Text.php @@ -620,7 +620,7 @@ protected static function appendEnd($text) { // extract the last char of $text if (function_exists('mb_substr')) { - $last = mb_substr($text, mb_strlen($text)-1, null, 'UTF-8'); + $last = mb_substr($text, 0, mb_strlen($text) - 1, null, 'UTF-8'); } else { $chars = static::split($text); $last = end($chars); @@ -630,6 +630,6 @@ protected static function appendEnd($text) $text = preg_replace('/.$/u', '', $text); } // if the last char is not a valid punctuation, append a default one. - return in_array($last, static::$endPunct) ? $text : $text.'。'; + return in_array($last, static::$endPunct) ? $text : $text . '。'; } } From 39197cde4b15e2ccbfd531828a5697a42ccc850e Mon Sep 17 00:00:00 2001 From: hejunwei Date: Wed, 7 Sep 2016 15:29:47 +0800 Subject: [PATCH 2/2] fix mb_substr missing parameter error when generating japanese string with realText method --- src/Faker/Provider/ja_JP/Text.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Faker/Provider/ja_JP/Text.php b/src/Faker/Provider/ja_JP/Text.php index b83bfde282..3455620270 100644 --- a/src/Faker/Provider/ja_JP/Text.php +++ b/src/Faker/Provider/ja_JP/Text.php @@ -620,7 +620,7 @@ protected static function appendEnd($text) { // extract the last char of $text if (function_exists('mb_substr')) { - $last = mb_substr($text, 0, mb_strlen($text) - 1, null, 'UTF-8'); + $last = mb_substr($text, 0, mb_strlen($text) - 1, 'UTF-8'); } else { $chars = static::split($text); $last = end($chars);