Fixes #17152: Fixed error page when using traceline option

This commit is contained in:
Sergei Sergeev
2019-03-18 00:34:47 +03:00
committed by Alexander Makarov
parent 0cbd1c12bc
commit a7276f6b72
3 changed files with 27 additions and 6 deletions

View File

@ -9,6 +9,7 @@ Yii Framework 2 Change Log
- Bug #17133: Fixed aliases rendering during help generation for a console command (GHopperMSK) - Bug #17133: Fixed aliases rendering during help generation for a console command (GHopperMSK)
- Bug #17185: Fixed `AssetManager` timestamp appending when a file is published manually (GHopperMSK) - Bug #17185: Fixed `AssetManager` timestamp appending when a file is published manually (GHopperMSK)
- Bug #17156: Fixes PHP 7.2 warning when a data provider has no data as a parameter for a GridView (evilito) - Bug #17156: Fixes PHP 7.2 warning when a data provider has no data as a parameter for a GridView (evilito)
- Bug #17152: Fixed error page when using traceline option (asamats)
- Bug #17083: Fixed `yii\validators\EmailValidator::$checkDNS` tells that every domain is correct on alpine linux (mikk150) - Bug #17083: Fixed `yii\validators\EmailValidator::$checkDNS` tells that every domain is correct on alpine linux (mikk150)
- Bug #17180: Do not populate `yii\web\Response::$response` when response code is 204 (mikk150) - Bug #17180: Do not populate `yii\web\Response::$response` when response code is 204 (mikk150)
- Bug #17124: Fixed ErrorException when run `./yii fixture/unload` without arguments (ricpelo) - Bug #17124: Fixed ErrorException when run `./yii fixture/unload` without arguments (ricpelo)

View File

@ -9,6 +9,12 @@
/* @var $end int */ /* @var $end int */
/* @var $args array */ /* @var $args array */
/* @var $handler \yii\web\ErrorHandler */ /* @var $handler \yii\web\ErrorHandler */
$html = <<<HTML
IDE
<svg class="icon icon--new-window" focusable="false" aria-hidden="true" width="16" height="16">
<use href="#new-window"></use>
</svg>
HTML;
?> ?>
<li class="<?= ($index === 1 || !$handler->isCoreFile($file)) ? 'application' : '' ?> call-stack-item" <li class="<?= ($index === 1 || !$handler->isCoreFile($file)) ? 'application' : '' ?> call-stack-item"
data-line="<?= (int) ($line - $begin) ?>"> data-line="<?= (int) ($line - $begin) ?>">
@ -16,6 +22,10 @@
<div class="element"> <div class="element">
<span class="item-number"><?= (int) $index ?>.</span> <span class="item-number"><?= (int) $index ?>.</span>
<span class="text"><?= $file !== null ? 'in ' . $handler->htmlEncode($file) : '' ?></span> <span class="text"><?= $file !== null ? 'in ' . $handler->htmlEncode($file) : '' ?></span>
<?php if ($handler->traceLine !== '{html}'): ?>
<span> &ndash; </span>
<?= strtr($handler->traceLine, ['{file}' => $file, '{line}' => $line + 1, '{html}' => $html]) ?>
<?php endif; ?>
<span class="at"> <span class="at">
<?= $line !== null ? 'at line' : '' ?> <?= $line !== null ? 'at line' : '' ?>
<span class="line"><?= $line !== null ? $line + 1 : '' ?></span> <span class="line"><?= $line !== null ? $line + 1 : '' ?></span>
@ -34,14 +44,12 @@
<?php for ($i = $begin; $i <= $end; ++$i): ?><div class="hover-line"></div><?php endfor; ?> <?php for ($i = $begin; $i <= $end; ++$i): ?><div class="hover-line"></div><?php endfor; ?>
<div class="code"> <div class="code">
<?php for ($i = $begin; $i <= $end; ++$i): ?><span class="lines-item"><?= (int) ($i + 1) ?></span><?php endfor; ?> <?php for ($i = $begin; $i <= $end; ++$i): ?><span class="lines-item"><?= (int) ($i + 1) ?></span><?php endfor; ?>
<pre> <pre><?php
<?php
// fill empty lines with a whitespace to avoid rendering problems in opera // fill empty lines with a whitespace to avoid rendering problems in opera
for ($i = $begin; $i <= $end; ++$i) { for ($i = $begin; $i <= $end; ++$i) {
echo (trim($lines[$i]) === '') ? " \n" : strtr($handler->traceLine, ['{file}' => $file, '{line}' => $i + 1, '{html}' => $handler->htmlEncode($lines[$i])]); echo (trim($lines[$i]) === '') ? " \n" : $handler->htmlEncode($lines[$i]);
} }
?> ?></pre>
</pre>
</div> </div>
</div> </div>
<?php endif; ?> <?php endif; ?>

View File

@ -381,6 +381,14 @@ body.mousedown pre {
</head> </head>
<body> <body>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" display="none">
<symbol id="new-window" viewBox="0 0 24 24">
<g transform="scale(0.0234375 0.0234375)">
<path d="M598 128h298v298h-86v-152l-418 418-60-60 418-418h-152v-86zM810 810v-298h86v298c0 46-40 86-86 86h-596c-48 0-86-40-86-86v-596c0-46 38-86 86-86h298v86h-298v596h596z"></path>
</g>
</symbol>
</svg>
<div class="header"> <div class="header">
<div class="tools"> <div class="tools">
<textarea id="clipboard"><?= $handler->htmlEncode($exception) ?></textarea> <textarea id="clipboard"><?= $handler->htmlEncode($exception) ?></textarea>
@ -487,7 +495,11 @@ window.onload = function() {
refreshCallStackItemCode(callStackItems[i]); refreshCallStackItemCode(callStackItems[i]);
// toggle code block visibility // toggle code block visibility
callStackItems[i].getElementsByClassName('element-wrap')[0].addEventListener('click', function() { callStackItems[i].getElementsByClassName('element-wrap')[0].addEventListener('click', function(event) {
if (event.target.nodeName.toLowerCase() === 'a') {
return;
}
var callStackItem = this.parentNode, var callStackItem = this.parentNode,
code = callStackItem.getElementsByClassName('code-wrap')[0]; code = callStackItem.getElementsByClassName('code-wrap')[0];