1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-01-16 21:08:34 +01:00

Fix parameter output if parameter is Datetime or array [v1.22.4] (#671)

* Fix parameter output if parameter is Datetime or array

* use array_map for parsing parameters
This commit is contained in:
Alius 2024-09-09 11:00:24 +03:00 committed by GitHub
parent ec4979077f
commit 02d26dbb2e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -82,11 +82,16 @@ class DoctrineCollector extends DataCollector implements Renderable, AssetProvid
*/
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'] ?? []);
}
/**