php-debugbar
php-debugbar copied to clipboard
Support html messages on MessagesCollector
From https://github.com/barryvdh/laravel-debugbar/issues/1654#issuecomment-2637599284
Unfortunately, no URLs allowed
Debugbar::getCollector('Quick Links')->addMessage('<a href="https://google.com">Test</a>');
Now:
Debugbar::getCollector('Quick Links')->addMessage('<a href="https://google.com">Test</a>', 'links', false);
Wouldn't this lead to possible XSS? Although the parameter should be given explicitly.
The third argument must be sent as false, by default it is true, basically you have to force the printing of html, also this package should only be used for development, not in production, but if it is a security risk it would be better to discard this PR
You could also use the third argument to indicate that it should be formatted to a specific lang for highlightjs,
here is an example indicating xml
->addMessage("<?xml version='1.0' encoding='UTF-8'?>\n<iva>\n\t<TypoIDInfor>R</TypoIDInfor>\n\t<IdInfor>0000</IdInfor>\n\t<rSocial>BM SA</rSocial>\n\t<year>2025</year>\n\t<month>01</month>\n</iva>", 'data', 'xml');