Skip to content
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

avoid PHP bug: use Config\Services #374

Merged
Merged
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
17 changes: 8 additions & 9 deletions system/CodeIgniter.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php namespace CodeIgniter;

use Config\Cache;
use Config\Services;
use CodeIgniter\HTTP\URI;
use CodeIgniter\Debug\Timer;
use CodeIgniter\Hooks\Hooks;
Expand Down Expand Up @@ -120,7 +119,7 @@ public function initialize()
date_default_timezone_set($this->config->appTimezone ?? 'UTC');

// Setup Exception Handling
Services::exceptions($this->config, true)
Config\Services::exceptions($this->config, true)
->initialize();

$this->detectEnvironment();
Expand Down Expand Up @@ -164,7 +163,7 @@ public function run(RouteCollectionInterface $routes = null)
}
catch (Router\RedirectException $e)
{
$logger = Services::logger();
$logger = Config\Services::logger();
$logger->info('REDIRECTED ROUTE at '.$e->getMessage());

// If the route is a 'redirect' route, it throws
Expand Down Expand Up @@ -196,7 +195,7 @@ protected function handleRequest(RouteCollectionInterface $routes = null, $cache
$this->tryToRouteIt($routes);

// Run "before" filters
$filters = Services::filters();
$filters = Config\Services::filters();
$uri = $this->request instanceof CLIRequest
? $this->request->getPath()
: $this->request->uri->getPath();
Expand Down Expand Up @@ -318,7 +317,7 @@ protected function startBenchmark()
{
$this->startTime = microtime(true);

$this->benchmark = Services::timer();
$this->benchmark = Config\Services::timer();
$this->benchmark->start('total_execution', $this->startTime);
$this->benchmark->start('bootstrap');
}
Expand All @@ -334,11 +333,11 @@ protected function getRequestObject()
{
if (is_cli())
{
$this->request = Services::clirequest($this->config);
$this->request = Config\Services::clirequest($this->config);
}
else
{
$this->request = Services::request($this->config);
$this->request = Config\Services::request($this->config);
$this->request->setProtocolVersion($_SERVER['SERVER_PROTOCOL']);
}
}
Expand All @@ -351,7 +350,7 @@ protected function getRequestObject()
*/
protected function getResponseObject()
{
$this->response = Services::response($this->config);
$this->response = Config\Services::response($this->config);

if ( ! is_cli())
{
Expand Down Expand Up @@ -551,7 +550,7 @@ protected function tryToRouteIt(RouteCollectionInterface $routes = null)
}

// $routes is defined in Config/Routes.php
$this->router = Services::router($routes);
$this->router = Config\Services::router($routes);

$path = $this->determinePath();

Expand Down