Skip to content
Closed
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
12 changes: 7 additions & 5 deletions system/Autoloader/FileLocatorCached.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,16 @@ public function listNamespaceFiles(string $prefix, string $path): array

public function locateFile(string $file, ?string $folder = null, string $ext = 'php'): false|string
{
if (isset($this->cache['locateFile'][$file][$folder][$ext])) {
return $this->cache['locateFile'][$file][$folder][$ext];
$folderKey = $folder ?? '';

if (isset($this->cache['locateFile'][$file][$folderKey][$ext])) {
return $this->cache['locateFile'][$file][$folderKey][$ext];
}

$files = $this->locator->locateFile($file, $folder, $ext);
$files = $this->locator->locateFile($file, $folderKey, $ext);

$this->cache['locateFile'][$file][$folder][$ext] = $files;
$this->cacheUpdated = true;
$this->cache['locateFile'][$file][$folderKey][$ext] = $files;
$this->cacheUpdated = true;

return $files;
}
Expand Down
6 changes: 3 additions & 3 deletions tests/system/Validation/RulesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ public static function provideRequiredWithAndOtherRuleWithValueZero(): iterable
}

#[DataProvider('provideRequiredWithout')]
public function testRequiredWithout(?string $field, ?string $check, bool $expected): void
public function testRequiredWithout(string $field, ?string $check, bool $expected): void
{
$data = [
'foo' => 'bar',
Expand All @@ -802,8 +802,8 @@ public static function provideRequiredWithout(): iterable
yield from [
['nope', 'bars', false],
['foo', 'nope', true],
[null, null, false],
[null, 'foo', true],
['', null, false],
['', 'foo', true],
['foo', null, true],
[
'array.emptyField1',
Expand Down
Loading