Skip to content

Commit cd82a0d

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into 4.6
2 parents 33bd537 + 19d5755 commit cd82a0d

File tree

8 files changed

+56
-14
lines changed

8 files changed

+56
-14
lines changed

.github/scripts/deploy-userguide

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,26 @@
66
SOURCE=$1
77
TARGET=$2
88
RELEASE=$3
9-
VERSION=`echo "$RELEASE" | cut -c 2-`
9+
10+
# Check if RELEASE is empty
11+
if [ -z "$RELEASE" ]; then
12+
echo "Error: \$RELEASE parameter is empty."
13+
exit 1
14+
fi
15+
16+
VERSION=$(echo "$RELEASE" | cut -c 2-)
17+
18+
# Check if VERSION is empty
19+
if [ -z "$VERSION" ]; then
20+
echo "Error: Failed to extract \$VERSION from \$RELEASE parameter '$RELEASE'."
21+
exit 1
22+
fi
23+
24+
# Check if VERSION matches the format X.Y.Z
25+
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
26+
echo "Error: VERSION '$VERSION' does not match the expected format X.Y.Z."
27+
exit 1
28+
fi
1029

1130
echo "Preparing for version $3"
1231
echo "Merging files from $1 to $2"

admin/starter/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
},
2121
"autoload": {
2222
"psr-4": {
23-
"App\\": "app/"
23+
"App\\": "app/",
24+
"Config\\": "app/Config"
2425
},
2526
"exclude-from-classmap": [
2627
"**/Database/Migrations/**"

phpstan-baseline.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10356,21 +10356,11 @@
1035610356
'count' => 1,
1035710357
'path' => __DIR__ . '/tests/system/Commands/CommandGeneratorTest.php',
1035810358
];
10359-
$ignoreErrors[] = [
10360-
'message' => '#^Method CodeIgniter\\\\Commands\\\\CommandTest\\:\\:getBuffer\\(\\) has no return type specified\\.$#',
10361-
'count' => 1,
10362-
'path' => __DIR__ . '/tests/system/Commands/CommandTest.php',
10363-
];
1036410359
$ignoreErrors[] = [
1036510360
'message' => '#^Method CodeIgniter\\\\Commands\\\\CommandTest\\:\\:provideCommandParsesArgsCorrectly\\(\\) return type has no value type specified in iterable type iterable\\.$#',
1036610361
'count' => 1,
1036710362
'path' => __DIR__ . '/tests/system/Commands/CommandTest.php',
1036810363
];
10369-
$ignoreErrors[] = [
10370-
'message' => '#^Method CodeIgniter\\\\Commands\\\\CommandTest\\:\\:testCommandParsesArgsCorrectly\\(\\) has parameter \\$expected with no value type specified in iterable type array\\.$#',
10371-
'count' => 1,
10372-
'path' => __DIR__ . '/tests/system/Commands/CommandTest.php',
10373-
];
1037410364
$ignoreErrors[] = [
1037510365
'message' => '#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#',
1037610366
'count' => 1,

system/Validation/Validation.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,10 @@ private function processIfExist(string $field, array $rules, array $data)
398398
break;
399399
}
400400
}
401-
} else {
401+
} elseif (str_contains($field, '.')) {
402402
$dataIsExisting = array_key_exists($ifExistField, $flattenedData);
403+
} else {
404+
$dataIsExisting = array_key_exists($ifExistField, $data);
403405
}
404406

405407
if (! $dataIsExisting) {

tests/system/Commands/CommandTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ protected function setUp(): void
4343
$this->commands = Services::commands();
4444
}
4545

46-
protected function getBuffer()
46+
protected function getBuffer(): string
4747
{
4848
return $this->getStreamFilterBuffer();
4949
}
@@ -130,6 +130,9 @@ public function testInexistentCommandsButWithManyAlternatives(): void
130130
$this->assertStringContainsString(':clear', $this->getBuffer());
131131
}
132132

133+
/**
134+
* @param list<string> $expected
135+
*/
133136
#[DataProvider('provideCommandParsesArgsCorrectly')]
134137
public function testCommandParsesArgsCorrectly(string $input, array $expected): void
135138
{

tests/system/Validation/RulesTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
use CodeIgniter\Test\CIUnitTestCase;
1717
use Config\Services;
18+
use ErrorException;
1819
use PHPUnit\Framework\Attributes\DataProvider;
1920
use PHPUnit\Framework\Attributes\Group;
2021
use stdClass;
@@ -126,6 +127,19 @@ public static function provideIfExist(): iterable
126127
];
127128
}
128129

130+
public function testIfExistArray(): void
131+
{
132+
$this->expectException(ErrorException::class);
133+
$this->expectExceptionMessage('Array to string conversion');
134+
135+
$rules = ['foo' => 'if_exist|alpha'];
136+
// Invalid array input
137+
$data = ['foo' => ['bar' => '12345']];
138+
139+
$this->validation->setRules($rules);
140+
$this->validation->run($data);
141+
}
142+
129143
#[DataProvider('providePermitEmpty')]
130144
public function testPermitEmpty(array $rules, array $data, bool $expected): void
131145
{

tests/system/Validation/StrictRules/RulesTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,4 +244,14 @@ public static function provideDiffers(): iterable
244244
'foo bar bool match' => [['foo' => true, 'bar' => true], false],
245245
];
246246
}
247+
248+
public function testIfExistArray(): void
249+
{
250+
$rules = ['foo' => 'if_exist|alpha'];
251+
// Invalid array input
252+
$data = ['foo' => ['bar' => '12345']];
253+
254+
$this->validation->setRules($rules);
255+
$this->assertFalse($this->validation->run($data));
256+
}
247257
}

user_guide_src/source/concepts/autoloader.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ Config files are namespaced in the ``Config`` namespace, not in ``App\Config`` a
9393
expect. This allows the core system files to always be able to locate them, even when the application
9494
namespace has changed.
9595

96+
.. note:: Since v4.5.3 appstarter, the ``Config\\`` namespace has been added to
97+
**composer.json**'s ``autoload.psr-4``.
98+
9699
Changing App Namespace
97100
----------------------
98101

0 commit comments

Comments
 (0)