-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[WebProfilerBundle] [VarDumper] Inject "unsafe-eval" into the CSP if the VarDumper was used #29155
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
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 |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
class VarDumper | ||
{ | ||
private static $handler; | ||
private static $afterDumpHandlerOnce; | ||
|
||
public static function dump($var) | ||
{ | ||
|
@@ -47,7 +48,14 @@ public static function dump($var) | |
}; | ||
} | ||
|
||
return (self::$handler)($var); | ||
$output = (self::$handler)($var); | ||
|
||
if (null !== self::$afterDumpHandlerOnce) { | ||
(self::$afterDumpHandlerOnce)($var); | ||
self::$afterDumpHandlerOnce = null; | ||
} | ||
|
||
return $output; | ||
} | ||
|
||
public static function setHandler(callable $callable = null) | ||
|
@@ -57,4 +65,12 @@ public static function setHandler(callable $callable = null) | |
|
||
return $prevHandler; | ||
} | ||
|
||
public static function setAfterDumpHandlerOnce(callable $callable = null) | ||
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. this looks like something we'd better avoid IMHO. 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. Sorry for getting back in touch so late. I'm aware this a not-important edge-case and I actually needed this at my old company and currently I don't. Anyways but I still want to finish this :) Do you mean to adapt this callback to be called every-time instead of that only once logic which simplifies it or something completely different? |
||
{ | ||
$prevHandler = self::$afterDumpHandlerOnce; | ||
self::$afterDumpHandlerOnce = $callable; | ||
|
||
return $prevHandler; | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.