diff --git a/system/CodeIgniter.php b/system/CodeIgniter.php index 304c5d06371b..76325987d25f 100644 --- a/system/CodeIgniter.php +++ b/system/CodeIgniter.php @@ -186,11 +186,6 @@ public function __construct(App $config) */ public function initialize() { - // Run this check for manual installations - if (! is_file(COMPOSER_PATH)) { - $this->resolvePlatformExtensions(); // @codeCoverageIgnore - } - // Set default locale on the server Locale::setDefault($this->config->defaultLocale ?? 'en'); @@ -206,6 +201,8 @@ public function initialize() * @throws FrameworkException * * @codeCoverageIgnore + * + * @deprecated 4.5.0 Moved to system/bootstrap.php. */ protected function resolvePlatformExtensions() { diff --git a/system/bootstrap.php b/system/bootstrap.php index 2c858d8bbc1c..a3f2ad0fba73 100644 --- a/system/bootstrap.php +++ b/system/bootstrap.php @@ -11,6 +11,7 @@ * the LICENSE file that was distributed with this source code. */ +use CodeIgniter\Exceptions\FrameworkException; use Config\Autoload; use Config\Modules; use Config\Paths; @@ -96,6 +97,33 @@ require_once APPPATH . 'Config/Constants.php'; } +/* + * --------------------------------------------------------------- + * CHECK SYSTEM FOR MISSING REQUIRED PHP EXTENSIONS + * --------------------------------------------------------------- + */ + +// Run this check for manual installations +if (! is_file(COMPOSER_PATH)) { + $requiredExtensions = [ + 'intl', + 'json', + 'mbstring', + ]; + + $missingExtensions = []; + + foreach ($requiredExtensions as $extension) { + if (! extension_loaded($extension)) { + $missingExtensions[] = $extension; + } + } + + if ($missingExtensions !== []) { + throw FrameworkException::forMissingExtension(implode(', ', $missingExtensions)); + } +} + /* * --------------------------------------------------------------- * LOAD COMMON FUNCTIONS