From d7d72e39b6253db974ead7a05ad257c3bd7f4101 Mon Sep 17 00:00:00 2001 From: SteveNay Date: Sat, 7 Jul 2018 00:16:00 +0630 Subject: [PATCH 1/2] [fix] php zero 0 string error --- clients/php/src/ZawgyiUnicodeMarkovModel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/php/src/ZawgyiUnicodeMarkovModel.php b/clients/php/src/ZawgyiUnicodeMarkovModel.php index 76fd936..747a440 100644 --- a/clients/php/src/ZawgyiUnicodeMarkovModel.php +++ b/clients/php/src/ZawgyiUnicodeMarkovModel.php @@ -210,7 +210,7 @@ public function predict(string $input, bool $verbose = false): float public static function ord_utf8($c) { - if (empty($c)) + if (is_null($c)) return; $u32 = mb_convert_encoding($c, "UTF-32BE"); From 17d9bd18c1d1ca3b0a20f6e530b4481d291760b6 Mon Sep 17 00:00:00 2001 From: SteveNay Date: Sat, 7 Jul 2018 00:32:23 +0630 Subject: [PATCH 2/2] [add] check empty character string with 3 equal signs --- clients/php/src/ZawgyiUnicodeMarkovModel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/php/src/ZawgyiUnicodeMarkovModel.php b/clients/php/src/ZawgyiUnicodeMarkovModel.php index 747a440..2fdd414 100644 --- a/clients/php/src/ZawgyiUnicodeMarkovModel.php +++ b/clients/php/src/ZawgyiUnicodeMarkovModel.php @@ -210,7 +210,7 @@ public function predict(string $input, bool $verbose = false): float public static function ord_utf8($c) { - if (is_null($c)) + if (is_null($c) || $c === "") return; $u32 = mb_convert_encoding($c, "UTF-32BE");