From 9ad2ba4113bac266f9314e71ffa36d295a7ef6dd Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Wed, 31 Jan 2018 09:08:43 +1100 Subject: [PATCH] CRM-21719 Add a check in Civi/Install/Requirements to ensure that PHP Multibyte functions are enabled on install --- Civi/Install/Requirements.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Civi/Install/Requirements.php b/Civi/Install/Requirements.php index ad0848e80bef..13506a22b276 100644 --- a/Civi/Install/Requirements.php +++ b/Civi/Install/Requirements.php @@ -28,6 +28,7 @@ class Requirements { 'checkServerVariables', 'checkMysqlConnectExists', 'checkJsonEncodeExists', + 'checkMultibyteExists', ); protected $database_checks = array( @@ -216,6 +217,24 @@ public function checkJsonEncodeExists() { return $results; } + /** + * CHeck that PHP Multibyte functions are enabled. + * @return array + */ + public function checkMultibyteExists() { + $results = array( + 'title' => 'CiviCRM MultiByte encoding support', + 'severity' => $this::REQUIREMENT_OK, + 'details' => 'PHP Multibyte etension found', + ); + if (!function_exists('mb_substr')) { + $results['severity'] = $this::REQUIREMENT_ERROR; + $results['details'] = 'PHP Multibyte extension has not been installed and enabled'; + } + + return $results; + } + /** * @return array */