Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Commit

Permalink
Fix mb_substr third param to support php 5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
bepsvpt committed Jan 9, 2016
1 parent a5e0c8f commit 2a55f52
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Faker/Provider/zh_TW/Text.php
Expand Up @@ -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];
Expand Down

0 comments on commit 2a55f52

Please sign in to comment.