Skip to content

Commit 22ffa33

Browse files
committed
fix(http): fix wrong data type
Call __toString() method explicitly to prevent data type errors. Just hide password and show username in debug logs.
1 parent 8fac75a commit 22ffa33

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/Component/Http/Server/Kernel.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,9 @@ public function setLogger(LoggerInterface $logger): void
114114
*/
115115
public function execute(bool $terminate = true, bool $clearUnexpectedBuffer = true): void
116116
{
117-
$this->logger->debug(sprintf(
118-
'Received request %s %s',
119-
$this->request->getMethod(),
120-
preg_replace('/(?<=:\/\/).*?(?=@)/', '***:***', $this->request->getUri())
121-
));
117+
$this->logger->debug(sprintf('Received request %s %s', $this->request->getMethod(), preg_replace(
118+
'/(?<=:\/\/)([^:]+):.*?(?=@)/', '$1:***', $this->request->getUri()->__toString()
119+
)));
122120

123121
$this->eventDispatcher?->dispatch(new BeforeHandleRequestEvent());
124122

0 commit comments

Comments
 (0)