From b4112d58e195ee09c8e2bd43b3a1efc93dc70266 Mon Sep 17 00:00:00 2001 From: michalsn Date: Fri, 19 Dec 2025 17:53:23 +0100 Subject: [PATCH 1/2] fix: null as an array offset is deprecated, use an empty string instead Co-authored-by: Denny Septian Panggabean <97607754+ddevsr@users.noreply.github.com> --- system/Autoloader/FileLocatorCached.php | 10 ++++++---- tests/system/Validation/RulesTest.php | 8 ++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/system/Autoloader/FileLocatorCached.php b/system/Autoloader/FileLocatorCached.php index 0aa267b2a84b..3e31a33d9e84 100644 --- a/system/Autoloader/FileLocatorCached.php +++ b/system/Autoloader/FileLocatorCached.php @@ -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); - $this->cache['locateFile'][$file][$folder][$ext] = $files; - $this->cacheUpdated = true; + $this->cache['locateFile'][$file][$folderKey][$ext] = $files; + $this->cacheUpdated = true; return $files; } diff --git a/tests/system/Validation/RulesTest.php b/tests/system/Validation/RulesTest.php index 8bb6cab3ce77..adad25616a18 100644 --- a/tests/system/Validation/RulesTest.php +++ b/tests/system/Validation/RulesTest.php @@ -693,8 +693,8 @@ public static function provideRequiredWith(): iterable ['nope', 'bar', false], ['foo', 'bar', true], ['nope', 'baz', true], - [null, null, true], - [null, 'foo', false], + ['', null, true], + ['', 'foo', false], ['foo', null, true], [ 'array.emptyField1', @@ -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', From 0a00c085bf4693ee3499000cc73463a1aac20295 Mon Sep 17 00:00:00 2001 From: michalsn Date: Sat, 20 Dec 2025 11:26:23 +0100 Subject: [PATCH 2/2] update tests signature --- tests/system/Validation/RulesTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/system/Validation/RulesTest.php b/tests/system/Validation/RulesTest.php index adad25616a18..37f7eebdfaa1 100644 --- a/tests/system/Validation/RulesTest.php +++ b/tests/system/Validation/RulesTest.php @@ -669,7 +669,7 @@ public static function provideInList(): iterable } #[DataProvider('provideRequiredWith')] - public function testRequiredWith(?string $field, ?string $check, bool $expected): void + public function testRequiredWith(string $field, ?string $check, bool $expected): void { $data = [ 'foo' => 'bar', @@ -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',