Skip to content

Commit

Permalink
fix: bug of trim multibyte characters
Browse files Browse the repository at this point in the history
  • Loading branch information
Chance-fyi committed Mar 31, 2023
1 parent ddb5b7f commit a7ebda6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/OperationLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,11 @@ public function generateLog($model, string $type)
break;
}
if (!empty($log)) {
array_splice($this->log, -1, 1, end($this->log) . trim($logHeader . $log, "") . PHP_EOL);
$lastChar = mb_substr($log, -1, 1, 'UTF-8');
if ($lastChar == '') {
$log = mb_substr($log, 0, mb_strlen($log, 'UTF-8') - 1, 'UTF-8');
}
array_splice($this->log, -1, 1, end($this->log) . $logHeader . $log . PHP_EOL);
}
}

Expand Down

0 comments on commit a7ebda6

Please sign in to comment.