Show full error message and hide backtrace#19934
Show full error message and hide backtrace#19934kamil-tekiela wants to merge 3 commits intophpmyadmin:masterfrom
Conversation
34f4469 to
e1da5d9
Compare
|
I am not sure to understand the after, can you share a screenshot? |
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
e1da5d9 to
830e09a
Compare
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
src/Error/ErrorHandler.php
Outdated
| if (! ($exception instanceof \Error) || ! $this->hideLocation) { | ||
| $message .= ': ' . $exception->getMessage(); | ||
| } | ||
| $message = $exception::class . ': ' . $exception->getMessage(); |
There was a problem hiding this comment.
There are some error messages that shows a full path. That's why the message is not included. If there's a way to sanitize the message to remove full paths, that'll be great.
There was a problem hiding this comment.
I can sanitize the path, e.g. with basename() but I would need to know when that happens. I can't think of a situation when that would happen now.
There was a problem hiding this comment.
A TypeError is an example.
Example from #19537:
TypeError: PhpMyAdmin\Util::formatNumber(): Argument #1 ($value) must be of type string|int|float, null given, called in /home/demo/.pma-demo-web/master-config/src/Controllers/Database/Structure/RealRowCountController.php on line 76
There was a problem hiding this comment.
I never noticed until now. You are right that these two messages contain the full path. https://github.com/php/php-src/blob/master/Zend/zend_exceptions.c#L740
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
be2fa6b to
f8b5323
Compare


There are two problems with how phpMyAdmin reports errors at the moment in production:
This PR should help avoid situations like this: #19904
When a warning happens it will show it like this:

and when an error happens, it will show an alternative error page:
