Review the proposed patch then download it to apply it manually or execute the following command from the repository root directory:
curl https://fabbot.io/patch/symfony/symfony/58151/70a66ae8c6dabf5e224b2ba238e4f2610680583a/cs.diff | patch -p0
diff -ru src/Symfony/Component/VarDumper/Resources/functions/dump.php src/Symfony/Component/VarDumper/Resources/functions/dump.php
--- src/Symfony/Component/VarDumper/Resources/functions/dump.php 2024-09-03 07:56:36.885908369 +0000
+++ src/Symfony/Component/VarDumper/Resources/functions/dump.php 2024-09-03 07:56:37.456928767 +0000
@@ -45,7 +45,7 @@
if (!function_exists('dd')) {
function dd(mixed ...$vars): never
{
- if (!\in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) && !headers_sent()) {
+ if (!in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) && !headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
@@ -58,9 +58,9 @@
$acceptHeader = $_SERVER['HTTP_ACCEPT'] ?? '---';
if (
- str_contains($acceptHeader, '*/*') ||
- str_contains($acceptHeader, 'text/html') ||
- \in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)
+ str_contains($acceptHeader, '*/*')
+ || str_contains($acceptHeader, 'text/html')
+ || in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)
) {
dump($vars);