-
-
Notifications
You must be signed in to change notification settings - Fork 17
Fix HtmlRenderer to handle FriendlyException attribute safely #147
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
c08cf44
40f70ae
9b259e2
c67a10b
2f7bad2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -510,14 +510,14 @@ | |
| try { | ||
| $reflectionClass = new ReflectionClass($throwable); | ||
| if (class_exists('Yiisoft\FriendlyException\Attribute\FriendlyException')) { | ||
| $attributes = $reflectionClass->getAttributes('Yiisoft\FriendlyException\Attribute\FriendlyException'); | ||
|
Check failure on line 513 in src/Renderer/HtmlRenderer.php
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same |
||
|
|
||
| if (!empty($attributes)) { | ||
| $friendlyExceptionAttribute = $attributes[0]->newInstance(); | ||
| $name = $friendlyExceptionAttribute->name . ' (' . $name . ')'; | ||
| } | ||
| } | ||
| } catch (\Throwable $e) { | ||
| } catch (\Throwable) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where do you expect an exception? I'd remove try/catch
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right, the try/catch block isn't necessary here. When checking for the FriendlyException attribute, it would be better to let any exceptions propagate normally, making potential issues easier to discover. I'll remove the try/catch block. Thank you for the suggestion! |
||
| // Ignore exception and keep default name | ||
| } | ||
| } | ||
|
|
||
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.
Use full class name notation without quotes