Skip to content

Commit

Permalink
bluescreen: added php://input preview
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Apr 3, 2024
1 parent 64435e3 commit 9e22a4f
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 11 deletions.
43 changes: 38 additions & 5 deletions src/Tracy/BlueScreen/assets/section-http.phtml
Expand Up @@ -44,20 +44,53 @@ if (Helpers::isCli()) {
<?php endif ?>


<?php foreach (['_GET', '_POST', '_COOKIE'] as $name): ?>
<h3>$<?= Helpers::escapeHtml($name) ?></h3>
<?php if (empty($GLOBALS[$name])):?>
<h3>$_GET</h3>
<?php if (empty($_GET)):?>
<p><i>empty</i></p>
<?php else: ?>
<div class="tracy-pane">
<table class="tracy-sortable">
<?php foreach ($GLOBALS[$name] as $k => $v): ?>
<?php foreach ($_GET as $k => $v): ?>
<tr><th><?= Helpers::escapeHtml($k) ?></th><td><?= $dump($v, $k) ?></td></tr>
<?php endforeach ?>
</table>
</div>
<?php endif ?>


<?php if ($_SERVER['REQUEST_METHOD'] ?? null === 'POST'):?>
<?php if (empty($_POST)):?>
<?php if (($post = file_get_contents('php://input', length: 2000)) === ''): ?>
<h3>$_POST</h3>
<p><i>empty</i></p>
<?php else: ?>
<h3>POST (preview)</h3>
<?= $dump($post) ?>
<?php endif ?>
<?php else: ?>
<h3>$_POST</h3>
<div class="tracy-pane">
<table class="tracy-sortable">
<?php foreach ($_POST as $k => $v): ?>
<tr><th><?= Helpers::escapeHtml($k) ?></th><td><?= $dump($v, $k) ?></td></tr>
<?php endforeach ?>
</table>
</div>
<?php endif ?>
<?php endif ?>

<h3>$_COOKIE</h3>
<?php if (empty($_COOKIE)):?>
<p><i>empty</i></p>
<?php else: ?>
<div class="tracy-pane">
<table class="tracy-sortable">
<?php foreach ($_COOKIE as $k => $v): ?>
<tr><th><?= Helpers::escapeHtml($k) ?></th><td><?= $dump($v, $k) ?></td></tr>
<?php endforeach ?>
</table>
</div>
<?php endif ?>
<?php endforeach ?>
</div>


Expand Down
5 changes: 3 additions & 2 deletions tests/Tracy/expected/Debugger.error-in-eval.expect
Expand Up @@ -175,8 +175,9 @@

<h3>$_GET</h3>
<p><i>empty</i></p>
<h3>$_POST</h3>
<p><i>empty</i></p>



<h3>$_COOKIE</h3>
<p><i>empty</i></p>
</div>
Expand Down
5 changes: 3 additions & 2 deletions tests/Tracy/expected/Debugger.exception.html.expect
Expand Up @@ -239,8 +239,9 @@

<h3>$_GET</h3>
<p><i>empty</i></p>
<h3>$_POST</h3>
<p><i>empty</i></p>



<h3>$_COOKIE</h3>
<p><i>empty</i></p>
</div>
Expand Down
5 changes: 3 additions & 2 deletions tests/Tracy/expected/Debugger.strict.html.expect
Expand Up @@ -178,8 +178,9 @@

<h3>$_GET</h3>
<p><i>empty</i></p>
<h3>$_POST</h3>
<p><i>empty</i></p>



<h3>$_COOKIE</h3>
<p><i>empty</i></p>
</div>
Expand Down

0 comments on commit 9e22a4f

Please sign in to comment.