From 8da8805f5d7fcdf822757c6892c619237fd40188 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Wed, 24 Apr 2019 13:48:49 +0200 Subject: [PATCH] Replaced functions with mb_* equivalents --- src/Middleware/RequestHandler.php | 2 +- src/Renderer/HtmlEngine.php | 2 +- src/Renderer/TwigLoader.php | 4 ++-- tests/Unit/Database/Migration/MigrateTest.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Middleware/RequestHandler.php b/src/Middleware/RequestHandler.php index b0fc664f..ce3fb718 100644 --- a/src/Middleware/RequestHandler.php +++ b/src/Middleware/RequestHandler.php @@ -67,7 +67,7 @@ class RequestHandler implements MiddlewareInterface */ protected function resolveRequestHandler($handler) { - if (is_string($handler) && strpos($handler, '@') !== false) { + if (is_string($handler) && mb_strpos($handler, '@') !== false) { list($class, $method) = explode('@', $handler, 2); if (!class_exists($class) && !$this->container->has($class)) { $class = sprintf('Engelsystem\\Controllers\\%s', $class); diff --git a/src/Renderer/HtmlEngine.php b/src/Renderer/HtmlEngine.php index 75343bbd..1feafcda 100644 --- a/src/Renderer/HtmlEngine.php +++ b/src/Renderer/HtmlEngine.php @@ -29,6 +29,6 @@ class HtmlEngine implements EngineInterface */ public function canRender($path) { - return strpos($path, '.htm') && file_exists($path); + return mb_strpos($path, '.htm') !== false && file_exists($path); } } diff --git a/src/Renderer/TwigLoader.php b/src/Renderer/TwigLoader.php index 154e6dbb..f20a8764 100644 --- a/src/Renderer/TwigLoader.php +++ b/src/Renderer/TwigLoader.php @@ -16,8 +16,8 @@ class TwigLoader extends FilesystemLoader public function findTemplate($name, $throw = true) { $extension = '.twig'; - $extensionLength = strlen($extension); - if (substr($name, -$extensionLength, $extensionLength) !== $extension) { + $extensionLength = mb_strlen($extension); + if (mb_substr($name, -$extensionLength, $extensionLength) !== $extension) { $name .= $extension; } diff --git a/tests/Unit/Database/Migration/MigrateTest.php b/tests/Unit/Database/Migration/MigrateTest.php index b1954fab..5f0f4ec6 100644 --- a/tests/Unit/Database/Migration/MigrateTest.php +++ b/tests/Unit/Database/Migration/MigrateTest.php @@ -92,7 +92,7 @@ class MigrateTest extends TestCase ) { $contains = false; foreach ($messages as $message) { - if (!Str::contains(strtolower($message), $type) || !Str::contains(strtolower($message), $value)) { + if (!Str::contains(mb_strtolower($message), $type) || !Str::contains(mb_strtolower($message), $value)) { continue; }