[PHP][Symfony] add debug flag to Controller.mustache#6842
[PHP][Symfony] add debug flag to Controller.mustache#6842wing328 merged 2 commits intoswagger-api:masterfrom
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.
Do not test against this, check for debug mode.
There was a problem hiding this comment.
Personally, I also prefer the debug flag.
There was a problem hiding this comment.
It makes sense seeing this is debug information. Production environment can also be run in debug mode.
There was a problem hiding this comment.
Okay i will change this in using debug
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)