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

Conversation

xizprodev
Copy link

Q A
Branch? 7.2
Bug fix? no
New feature? no
Deprecations? no
Issues *
License MIT

A lot of people (including me) use SPA/javascript applications and it would be easier if you could sometimes see the result directly in the browser without having to copy the request to Insomnia or to always manually enter the necessary headers.

@carsonbot carsonbot added this to the 7.2 milestone Sep 15, 2024
@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has a contribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (see https://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (see https://symfony.com/releases)
  • Features and deprecations must be submitted against the 7.2 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@94noni
Copy link
Contributor

94noni commented Sep 17, 2024

you can also leverage https://symfony.com/doc/current/components/var_dumper.html#the-dump-server
so you stay on your browser on your page doing spa stuff and in your terminal, you can see all dumps output from the backend

header("Access-Control-Allow-Origin: " . $_SERVER['HTTP_ORIGIN'] ?? '*');
header('Access-Control-Allow-Methods: *');
header('Access-Control-Allow-Headers: *');
header('Access-Control-Allow-Credentials: true');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sending headers while containing the execution of the code after that function looks like a very bad idea to me (as it will likely break the response sending done later)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dd does not continue execution, as it dumps and dies

Copy link
Author

@xizprodev xizprodev Sep 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, sry, i remove this. i don't think is needed.
update: i always end with ddh and it's working.

header("Access-Control-Allow-Origin: " . $_SERVER['HTTP_ORIGIN'] ?? '*');
header('Access-Control-Allow-Methods: *');
header('Access-Control-Allow-Headers: *');
header('Access-Control-Allow-Credentials: true');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be added directly to dd instead ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe? i am not sure, i never have problems with dd, expect SPA/javascript apps.
i don't think adding directly to dd will negative impact any scenario, since is a debug function.
on my local machine i always add this to dd and i don't have any problems.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be inside the check for header_sent as done for the other header ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, you right, updated.

@xizprodev
Copy link
Author

@94noni thanks! But i think it easier to read directly from browser. (just my opinion)

@nicolas-grekas
Copy link
Member

Let's work on #58070 instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.