Skip to content

Commit 014a204

Browse files
committed
fix: Crash when caching config
1 parent 593517e commit 014a204

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/Config/Services.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use CodeIgniter\HTTP\ResponseInterface;
88
use CodeIgniter\HTTP\UserAgent;
99
use Config\App;
10+
use Config\Paths;
1011
use Config\Services as AppServices;
1112
use Config\Toolbar as ToolbarConfig;
1213
use Config\View as ViewConfig;
@@ -31,7 +32,7 @@ public static function renderer(?string $viewPath = null, ?ViewConfig $config =
3132
return static::getSharedInstance('renderer', $viewPath, $config);
3233
}
3334

34-
$viewPath = $viewPath ?: config('Paths')->viewDirectory;
35+
$viewPath = $viewPath ?: (new Paths())->viewDirectory;
3536
$config ??= config('View');
3637

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

tests/CommonTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Tests;
44

55
use CodeIgniter\Test\CIUnitTestCase;
6+
use Config\Paths;
67

78
/**
89
* @internal
@@ -13,7 +14,7 @@ protected function setUp(): void
1314
{
1415
parent::setUp();
1516

16-
config('Paths')->viewDirectory = SUPPORTPATH . 'Views';
17+
(new Paths())->viewDirectory = SUPPORTPATH . 'Views';
1718
}
1819

1920
public function testViewFragmentNone(): void

0 commit comments

Comments
 (0)