-
Notifications
You must be signed in to change notification settings - Fork 6k
[PHP][Symfony] add debug flag to Controller.mustache #6842
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
Conversation
|
@cydrickn can you elaborate a bit more on the change? Is that a bug fix or enhancement? cc @naelrashdeen @ksm2 @jebentier @dkarlovi @mandrean @jfastnacht @ackintosh |
|
Hi @wing328, The changes is for php symfony to not response to user the class name and not to response the stack trace of errors for prod environment. Thanks |
|
@cydrickn thanks for the explanation. If I might, I would suggest adding an "else" clause: if ($this->container->get('kernel')->getEnvironment() === 'prod') {
return [
'message' => $exception->getMessage(),
];
} else {
return [
'message' => $exception->getMessage(),
'type' => get_class($exception),
'previous' => $this->exceptionToArray($exception->getPrevious()),
];
}and also including a 1-liner explaining the difference. |
| return null; | ||
| } | ||
|
|
||
| if ($this->container->get('kernel')->getEnvironment() === 'prod') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not test against this, check for debug mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I also prefer the debug flag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes sense seeing this is debug information. Production environment can also be run in debug mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay i will change this in using debug
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done changes in commit
60a2c7a
PR checklist
./bin/to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.shand./bin/security/{LANG}-petstore.shif updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\.3.0.0branch for changes related to OpenAPI spec 3.0. Default:master.Description of the
(details of the change, additional tests that have been done, reference to the issue for tracking, etc)