1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-07-25 02:31:25 +02:00

Fix content security policy failure due to <script> tags without nonce generated by HtmlDumper (#563)

This commit is contained in:
Yannik Sembritzki
2023-09-19 16:04:51 +02:00
committed by GitHub
parent 1bee671914
commit 61d4cad24b

View File

@@ -1046,6 +1046,10 @@ class JavascriptRenderer
$nonce = $this->getNonceAttribute();
if ($nonce != '') {
$js = preg_replace("/<script>/", "<script nonce='{$this->cspNonce}'>", $js);
}
if ($this->useRequireJs){
return "<script type=\"text/javascript\"{$nonce}>\nrequire(['debugbar'], function(PhpDebugBar){ $js });\n</script>\n";
} else {