Skip to content

Commit

Permalink
Merge pull request #73 from neznaika0/fix-cache-crash
Browse files Browse the repository at this point in the history
fix: Error when config cache is enabled
  • Loading branch information
michalsn authored Sep 9, 2024
2 parents 593517e + f08cf98 commit f3a37ac
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Config/Services.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\HTTP\UserAgent;
use Config\App;
use Config\Optimize;
use Config\Paths;
use Config\Services as AppServices;
use Config\Toolbar as ToolbarConfig;
use Config\View as ViewConfig;
Expand All @@ -31,7 +33,10 @@ public static function renderer(?string $viewPath = null, ?ViewConfig $config =
return static::getSharedInstance('renderer', $viewPath, $config);
}

$viewPath = $viewPath ?: config('Paths')->viewDirectory;
$viewPath = $viewPath ?: ((new Optimize())->configCacheEnabled ?
(new Paths())->viewDirectory :
config('Paths')->viewDirectory);

$config ??= config('View');

return new View($config, $viewPath, AppServices::locator(), CI_DEBUG, AppServices::logger());
Expand Down

0 comments on commit f3a37ac

Please sign in to comment.