Skip to content

Use message directly if intl is not available #4549

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 6 additions & 17 deletions system/CodeIgniter.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,6 @@ class CodeIgniter
*/
protected $useSafeOutput = false;

//--------------------------------------------------------------------

/**
* Constructor.
*
Expand All @@ -154,15 +152,13 @@ public function __construct(App $config)
{
if (version_compare(PHP_VERSION, self::MIN_PHP_VERSION, '<'))
{
die(lang('Core.invalidPhpVersion', [self::MIN_PHP_VERSION, PHP_VERSION]));
exit(lang('Core.invalidPhpVersion', [self::MIN_PHP_VERSION, PHP_VERSION]));
}

$this->startTime = microtime(true);
$this->config = $config;
}

//--------------------------------------------------------------------

/**
* Handles some basic app and environment setup.
*/
Expand All @@ -178,9 +174,7 @@ public function initialize()
// Run this check for manual installations
if (! is_file(COMPOSER_PATH))
{
// @codeCoverageIgnoreStart
$this->resolvePlatformExtensions();
// @codeCoverageIgnoreEnd
$this->resolvePlatformExtensions(); // @codeCoverageIgnore
}

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

if (! CI_DEBUG)
{
// @codeCoverageIgnoreStart
Kint::$enabled_mode = false;
// @codeCoverageIgnoreEnd
Kint::$enabled_mode = false; // @codeCoverageIgnore
}
}

//--------------------------------------------------------------------

/**
* Checks system for missing required PHP extensions.
*
* @return void
* @throws FrameworkException
*
* @return void
*
* @codeCoverageIgnore
*/
protected function resolvePlatformExtensions()
Expand All @@ -229,14 +220,12 @@ protected function resolvePlatformExtensions()
}
}

if ($missingExtensions)
if ($missingExtensions !== [])
{
throw FrameworkException::forMissingExtension(implode(', ', $missingExtensions));
}
}

//--------------------------------------------------------------------

/**
* Initializes Kint
*/
Expand Down
16 changes: 15 additions & 1 deletion system/Exceptions/FrameworkException.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,21 @@ public static function forCopyError(string $path)

public static function forMissingExtension(string $extension)
{
return new static(lang('Core.missingExtension', [$extension]));
if (strpos($extension, 'intl') !== false)
{
// @codeCoverageIgnoreStart
$message = sprintf(
'The framework needs the following extension(s) installed and loaded: %s.',
$extension
);
// @codeCoverageIgnoreEnd
}
else
{
$message = lang('Core.missingExtension', [$extension]);
}

return new static($message);
}

public static function forNoHandlers(string $class)
Expand Down