[VarDumper] Backport handler lock when using VAR_DUMPER_FORMAT
This commit is contained in:
parent
0bb2a1a918
commit
19b341e2b2
@ -235,13 +235,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||
--$i;
|
||||
}
|
||||
|
||||
if (isset($_SERVER['VAR_DUMPER_FORMAT'])) {
|
||||
$html = 'html' === $_SERVER['VAR_DUMPER_FORMAT'];
|
||||
} else {
|
||||
$html = !\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) && stripos($h[$i], 'html');
|
||||
}
|
||||
|
||||
if ($html) {
|
||||
if (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) && stripos($h[$i], 'html')) {
|
||||
$dumper = new HtmlDumper('php://output', $this->charset);
|
||||
$dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
|
||||
} else {
|
||||
|
@ -53,6 +53,12 @@ class VarDumper
|
||||
public static function setHandler(callable $callable = null)
|
||||
{
|
||||
$prevHandler = self::$handler;
|
||||
|
||||
// Prevent replacing the handler with expected format as soon as the env var was set:
|
||||
if (isset($_SERVER['VAR_DUMPER_FORMAT'])) {
|
||||
return $prevHandler;
|
||||
}
|
||||
|
||||
self::$handler = $callable;
|
||||
|
||||
return $prevHandler;
|
||||
|
Reference in New Issue
Block a user