Skip to content

Commit

Permalink
Fix for PHP 8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Nightprince committed Dec 24, 2024
1 parent 7c6a1e3 commit 71a17f9
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 113 deletions.
4 changes: 3 additions & 1 deletion application/config/Boot/production.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
|
| If you set 'display_errors' to '1', CI4's detailed error report will show.
*/
error_reporting(E_ALL & ~E_DEPRECATED);
// If you want to suppress more types of errors.
// error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
ini_set('display_errors', '0');
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);

/*
|--------------------------------------------------------------------------
Expand Down
17 changes: 9 additions & 8 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,19 @@

$paths = new App\Config\Paths();

// Location of the framework bootstrap file.
require rtrim($paths->systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'bootstrap.php';

// Load environment settings from .env files into $_SERVER and $_ENV
require_once SYSTEMPATH . 'Config/DotEnv.php';
(new DotEnv(ROOTPATH))->load();

// Define ENVIRONMENT
if (! defined('ENVIRONMENT')) {
define('ENVIRONMENT', env('CI_ENVIRONMENT', 'production'));
// @phpstan-ignore-next-line
$env = $_ENV['CI_ENVIRONMENT'] ?? $_SERVER['CI_ENVIRONMENT']
?? getenv('CI_ENVIRONMENT')
?: 'production';

define('ENVIRONMENT', $env);
}

// Location of the framework bootstrap file.
require rtrim($paths->systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'bootstrap.php';

// Load Config Cache
// $factoriesCache = new \CodeIgniter\Cache\FactoriesCache();
// $factoriesCache->load('config');
Expand Down
16 changes: 0 additions & 16 deletions system/CodeIgniter.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,6 @@
$benchmark->start('total_execution');
$benchmark->start('bootstrap');

/*
* ------------------------------------------------------
* Load any environment-specific settings from .env file
* ------------------------------------------------------
*/
if (is_file(APPPATH . 'config/Boot/' . ENVIRONMENT . '.php')) {
require_once APPPATH . 'config/Boot/' . ENVIRONMENT . '.php';
} else {
// @codeCoverageIgnoreStart{
header('HTTP/1.1 503 Service Unavailable.', true, 503);
echo 'The application environment is not set correctly.';

exit(EXIT_ERROR); // EXIT_ERROR
// @codeCoverageIgnoreEnd
}

//--------------------------------------------------------------------
// CSRF Protection
//--------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion system/Config/Services.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public static function routes($getShared = false)
* The Router class uses a RouteCollection's array of routes, and determines
* the correct Controller and Method to execute.
*/
public static function router(RouteCollectionInterface $routes = null, bool $getShared = false)
public static function router(?RouteCollectionInterface $routes = null, bool $getShared = false)
{
if ($getShared === true)
{
Expand Down
Loading

0 comments on commit 71a17f9

Please sign in to comment.