Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Improve dump for SPA apps like. #58268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions 31 src/Symfony/Component/VarDumper/Resources/functions/dump.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,34 @@
exit(1);
}
}

if (!function_exists('ddh')) {
function ddh(mixed ...$vars): never
{
if (!\in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) && !headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');

// CORS for SPA apps like.
header("Access-Control-Allow-Origin: " . $_SERVER['HTTP_ORIGIN'] ?? '*');

Check failure on line 77 in src/Symfony/Component/VarDumper/Resources/functions/dump.php

View workflow job for this annotation

GitHub Actions / Psalm

InvalidArgument

src/Symfony/Component/VarDumper/Resources/functions/dump.php:77:20: InvalidArgument: Isset only works with variables and array elements (see https://psalm.dev/004)

Check failure on line 77 in src/Symfony/Component/VarDumper/Resources/functions/dump.php

View workflow job for this annotation

GitHub Actions / Psalm

InvalidArgument

src/Symfony/Component/VarDumper/Resources/functions/dump.php:77:20: InvalidArgument: Isset only works with variables and array elements (see https://psalm.dev/004)
header('Access-Control-Allow-Methods: *');
header('Access-Control-Allow-Headers: *');
header('Access-Control-Allow-Credentials: true');
}

if (!$vars) {
VarDumper::dump(new ScalarStub('🐛'));

exit(1);
}

if (array_key_exists(0, $vars) && 1 === count($vars)) {
VarDumper::dump($vars[0]);
} else {
foreach ($vars as $k => $v) {
VarDumper::dump($v, is_int($k) ? 1 + $k : $k);
}
}

exit(1);
}
}
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.