From c6b2865ef68c6758c9213479dbb6b57537235f6c Mon Sep 17 00:00:00 2001 From: Juan Antonio Tubio Date: Tue, 18 Jul 2017 16:44:05 +0200 Subject: [PATCH] Checking if mb_strpos() exists before use them --- src/Valitron/Validator.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Valitron/Validator.php b/src/Valitron/Validator.php index fad587b..b334f8e 100644 --- a/src/Valitron/Validator.php +++ b/src/Valitron/Validator.php @@ -1133,7 +1133,12 @@ class Validator $message = isset($msgs[$rule]) ? $msgs[$rule] : self::ERROR_DEFAULT; // Ensure message contains field label - if (mb_strpos($message, '{field}') === false) { + if (function_exists('mb_strpos')) { + $notContains = mb_strpos($message, '{field}') === false; + } else { + $notContains = strpos($message, '{field}') === false; + } + if ($notContains) { $message = '{field} ' . $message; }