Skip to content
Merged
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
4 changes: 2 additions & 2 deletions system/Language/Language.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public function getLine(string $line, array $args = [])
}

/**
* @return list<string>|string|null
* @return array<array-key, mixed>|string|null
*/
protected function getTranslationOutput(string $locale, string $file, string $parsedLine)
{
Expand All @@ -160,7 +160,7 @@ protected function getTranslationOutput(string $locale, string $file, string $pa
}
}

if ($output !== null && ! is_array($output)) {
if ($output !== null) {
return $output;
}
}
Expand Down
13 changes: 13 additions & 0 deletions tests/system/Language/LanguageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,19 @@ public function testLanguageNestedArrayDefinition(): void
$this->assertSame('e', $lang->getLine('Nested.a.b.c.d'));
}

/**
* @see https://github.com/codeigniter4/CodeIgniter4/issues/10187
*/
public function testLanguageNestedArrayDefinitionReturnsIntermediateArrays(): void
{
$lang = new SecondMockLanguage('en');
$lang->loadem('Nested', 'en');

$this->assertSame(['b' => ['c' => ['d' => 'e']]], $lang->getLine('Nested.a'));
$this->assertSame(['c' => ['d' => 'e']], $lang->getLine('Nested.a.b'));
$this->assertSame(['d' => 'e'], $lang->getLine('Nested.a.b.c'));
}

public function testLanguageKeySeparatedByDot(): void
{
$lang = new SecondMockLanguage('en');
Expand Down
1 change: 1 addition & 0 deletions user_guide_src/source/changelogs/v4.7.3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Bugs Fixed
- **Database:** Fixed a bug where the PostgreSQL driver's ``increment()`` and ``decrement()`` methods were not working for numeric columns.
- **Database:** Fixed a bug where the SQLSRV driver's decrement method was adding instead of subtracting the decrement value when ``$castTextToInt`` was false.
- **Kint:** Fixed a bug where stale Content Security Policy nonces were reused in worker mode, causing browser CSP violations for Debug Toolbar assets.
- **Language:** Fixed a bug where ``Language::getLine()`` returned the literal dot-notation key instead of the nested array value when the requested key resolved to an intermediate array three or more levels deep.
- **Toolbar:** Fixed a bug where the Logs collector raised an undefined property error when using a third-party PSR-3 logger.
- **Time:** Fixed a bug where ``Time::createFromTimestamp()`` could fail for microsecond timestamps when ``LC_NUMERIC`` used a comma decimal separator.
- **Validation:** Fixed a bug where ``Validation::getValidated()`` dropped fields whose validated value was explicitly ``null``.
Expand Down
Loading