Skip to content

Commit f34b46b

Browse files
authored
Merge pull request #4549 from paulbalandan/ci-missing-ext
2 parents 18436cb + c92d47e commit f34b46b

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

system/CodeIgniter.php

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,6 @@ class CodeIgniter
143143
*/
144144
protected $useSafeOutput = false;
145145

146-
//--------------------------------------------------------------------
147-
148146
/**
149147
* Constructor.
150148
*
@@ -154,15 +152,13 @@ public function __construct(App $config)
154152
{
155153
if (version_compare(PHP_VERSION, self::MIN_PHP_VERSION, '<'))
156154
{
157-
die(lang('Core.invalidPhpVersion', [self::MIN_PHP_VERSION, PHP_VERSION]));
155+
exit(lang('Core.invalidPhpVersion', [self::MIN_PHP_VERSION, PHP_VERSION]));
158156
}
159157

160158
$this->startTime = microtime(true);
161159
$this->config = $config;
162160
}
163161

164-
//--------------------------------------------------------------------
165-
166162
/**
167163
* Handles some basic app and environment setup.
168164
*/
@@ -178,9 +174,7 @@ public function initialize()
178174
// Run this check for manual installations
179175
if (! is_file(COMPOSER_PATH))
180176
{
181-
// @codeCoverageIgnoreStart
182-
$this->resolvePlatformExtensions();
183-
// @codeCoverageIgnoreEnd
177+
$this->resolvePlatformExtensions(); // @codeCoverageIgnore
184178
}
185179

186180
// Set default locale on the server
@@ -193,20 +187,17 @@ public function initialize()
193187

194188
if (! CI_DEBUG)
195189
{
196-
// @codeCoverageIgnoreStart
197-
Kint::$enabled_mode = false;
198-
// @codeCoverageIgnoreEnd
190+
Kint::$enabled_mode = false; // @codeCoverageIgnore
199191
}
200192
}
201193

202-
//--------------------------------------------------------------------
203-
204194
/**
205195
* Checks system for missing required PHP extensions.
206196
*
207-
* @return void
208197
* @throws FrameworkException
209198
*
199+
* @return void
200+
*
210201
* @codeCoverageIgnore
211202
*/
212203
protected function resolvePlatformExtensions()
@@ -229,14 +220,12 @@ protected function resolvePlatformExtensions()
229220
}
230221
}
231222

232-
if ($missingExtensions)
223+
if ($missingExtensions !== [])
233224
{
234225
throw FrameworkException::forMissingExtension(implode(', ', $missingExtensions));
235226
}
236227
}
237228

238-
//--------------------------------------------------------------------
239-
240229
/**
241230
* Initializes Kint
242231
*/

system/Exceptions/FrameworkException.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,21 @@ public static function forCopyError(string $path)
4040

4141
public static function forMissingExtension(string $extension)
4242
{
43-
return new static(lang('Core.missingExtension', [$extension]));
43+
if (strpos($extension, 'intl') !== false)
44+
{
45+
// @codeCoverageIgnoreStart
46+
$message = sprintf(
47+
'The framework needs the following extension(s) installed and loaded: %s.',
48+
$extension
49+
);
50+
// @codeCoverageIgnoreEnd
51+
}
52+
else
53+
{
54+
$message = lang('Core.missingExtension', [$extension]);
55+
}
56+
57+
return new static($message);
4458
}
4559

4660
public static function forNoHandlers(string $class)

0 commit comments

Comments
 (0)