Skip to content

Commit

Permalink
Finish fix
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbalandan committed Jun 1, 2022
1 parent 43beea2 commit 0cb9f33
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions system/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -1015,11 +1015,13 @@ function slash_item(string $item): ?string
{
$config = config(App::class);

$configItem = '';

if (property_exists($config, $item)) {
$configItem = $config->{$item};
$configItem = (string) $config->{$item};
}

if (! isset($configItem) || empty(trim($configItem))) {
if (trim($configItem) === '') {
return null;
}

Expand Down
6 changes: 3 additions & 3 deletions tests/system/CommonFunctionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,9 @@ public function testReallyWritable()

public function testSlashItem()
{
$this->assertSame('/', slash_item('cookiePath')); // slash already there
$this->assertNull(null, slash_item('cookieDomain')); // empty, so untouched
$this->assertSame('en/', slash_item('defaultLocale')); // slash appended
$this->assertSame('/', slash_item('cookiePath'));
$this->assertNull(slash_item('cookieDomain'));
$this->assertSame('en/', slash_item('defaultLocale'));
}

protected function injectSessionMock()
Expand Down

0 comments on commit 0cb9f33

Please sign in to comment.