-
-
Notifications
You must be signed in to change notification settings - Fork 17
Render exception class PHPDoc description in HTML debug output #167
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 all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -9,6 +9,7 @@ | |||||
| /** | ||||||
| * @var ServerRequestInterface|null $request | ||||||
| * @var Throwable $throwable | ||||||
| * @var string|null $exceptionDescription | ||||||
| */ | ||||||
|
|
||||||
| $theme = $_COOKIE['yii-exception-theme'] ?? ''; | ||||||
|
|
@@ -93,6 +94,10 @@ | |||||
| <?= nl2br($this->htmlEncode($exceptionMessage)) ?> | ||||||
| </div> | ||||||
|
|
||||||
| <?php if ($exceptionDescription !== null): ?> | ||||||
| <div class="exception-description solution"><?= $this->parseMarkdown($exceptionDescription) ?></div> | ||||||
|
||||||
| <div class="exception-description solution"><?= $this->parseMarkdown($exceptionDescription) ?></div> | |
| <div class="exception-description solution"><?= $this->parseMarkdown($this->htmlEncode($exceptionDescription)) ?></div> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Yiisoft\ErrorHandler\Tests\Support; | ||
|
|
||
| use RuntimeException; | ||
|
|
||
| /** | ||
| * Test summary with {@see RuntimeException}. | ||
| * | ||
| * More details with {@link https://www.yiiframework.com Yii Framework}. | ||
| * | ||
| * @link https://example.com Ignored tag. | ||
| */ | ||
| final class TestDocBlockException extends RuntimeException {} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Yiisoft\ErrorHandler\Tests\Support; | ||
|
|
||
| use RuntimeException; | ||
|
|
||
| final class TestExceptionWithoutDocBlock extends RuntimeException {} |
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.
getThrowableDescription()returns raw PHPDoc text (with inline tag substitutions) that can contain arbitrary HTML/Markdown. BecauseparseMarkdown()does not sanitize attributes/URL schemes, a PHPDoc containing HTML like<img onerror=...>or markdown links tojavascript:could result in XSS when rendered. Consider escaping/removing raw HTML in the extracted description and validating link/image URL schemes before handing it to the markdown renderer.