Skip to content

Commit

Permalink
[Bug] Fix class and interface check with nullable value (#39)
Browse files Browse the repository at this point in the history
* fix class and interface check with nullable value

* use same fix as in 6.1.0

---------

Co-authored-by: Léa Crémier <[email protected]>
  • Loading branch information
Laiah authored Jan 3, 2024
1 parent 11d6903 commit 09ac134
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Processors/Monolog/DeamonLoggerExtraWebProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ private function addRequestInfo(): void
*/
private function addUserInfo(): void
{
if (!$this->configShowExtraInfo('user')) {
if (!$this->configShowExtraInfo('user') || empty($this->userClass)) {
return;
}

Expand Down
13 changes: 13 additions & 0 deletions Tests/Processors/Monolog/DeamonLoggerExtraWebProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,19 @@ public function testAddUserInfoWithNotExistingClass()
$this->assertArrayNotHasKey('user_name', $record['extra']);
}


public function testAddUserInfoWithEmptyUserClass()
{
$config = $this->getDisplayConfig([
'user' => true,
], null, '');

$processor = new DeamonLoggerExtraWebProcessor($config);
$record = $processor->__invoke($this->getRecord());

$this->assertArrayNotHasKey('user_name', $record['extra']);
}

public function testAddUserinfoWithNoTokenStorage()
{
$config = $this->getDisplayConfig([
Expand Down

0 comments on commit 09ac134

Please sign in to comment.