Skip to content

Commit

Permalink
Fix parameter output if parameter is Datetime or array [v1.22.4] (#671)
Browse files Browse the repository at this point in the history
* Fix parameter output if parameter is Datetime or array

* use array_map for parsing parameters
  • Loading branch information
aliusa authored Sep 9, 2024
1 parent ec49790 commit 02d26db
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/DebugBar/Bridge/DoctrineCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,16 @@ public function collect()
*/
public function getParameters($query) : array
{
$params = [];
foreach ($query['params'] ?? [] as $name => $param) {
$params[$name] = htmlentities($param?:"", ENT_QUOTES, 'UTF-8', false);
}
return $params;
return array_map(function ($param) {
if (is_string($param)) {
return htmlentities($param, ENT_QUOTES, 'UTF-8', false);
} elseif (is_array($param)) {
return implode(', ', $param);
} elseif ($param instanceof \DateTimeInterface) {
return $param->format('Y-m-d H:i:s');
}
return $param ?: '';
}, $query['params'] ?? []);
}

/**
Expand Down

0 comments on commit 02d26db

Please sign in to comment.