Skip to content

Commit

Permalink
Merge pull request #4378 from GrahamCampbell/4.2-whoops
Browse files Browse the repository at this point in the history
[4.2] Updated Whoops
  • Loading branch information
taylorotwell committed May 12, 2014
2 parents 43f388b + 0cc3f87 commit a862125
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 218 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -14,7 +14,7 @@
"classpreloader/classpreloader": "~1.0",
"d11wtq/boris": "~1.0",
"ircmaxell/password-compat": "~1.0",
"filp/whoops": "1.0.10",
"filp/whoops": "1.1.*",
"jeremeamia/superclosure": "~1.0",
"monolog/monolog": "~1.6",
"nesbot/carbon": "~1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Exception/ExceptionServiceProvider.php
Expand Up @@ -160,7 +160,7 @@ protected function registerPrettyWhoopsHandler()
// displayed back to the developer. Otherwise, the default pages are run.
if ( ! is_null($path = $this->resourcePath()))
{
$handler->setResourcesPath($path);
$handler->addResourcePath($path);
}

return $handler;
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Exception/composer.json
Expand Up @@ -9,7 +9,7 @@
],
"require": {
"php": ">=5.4.0",
"filp/whoops": "1.0.10",
"filp/whoops": "1.1.*",
"illuminate/support": "4.2.*",
"symfony/http-foundation": "2.5.*",
"symfony/http-kernel": "2.5.*"
Expand Down
File renamed without changes.
215 changes: 0 additions & 215 deletions src/Illuminate/Exception/resources/pretty-template.php

This file was deleted.

51 changes: 51 additions & 0 deletions src/Illuminate/Exception/resources/views/frame_code.html.php
@@ -0,0 +1,51 @@
<?php /* Display a code block for all frames in the stack.
* @todo: This should PROBABLY be done on-demand, lest
* we get 200 frames to process. */ ?>
<div class="frame-code-container <?php echo (!$has_frames ? 'empty' : '') ?>">
<?php foreach($frames as $i => $frame): ?>
<?php $line = $frame->getLine(); ?>
<div class="frame-code <?php echo ($i == 0 ) ? 'active' : '' ?>" id="frame-code-<?php echo $i ?>">
<div class="frame-file">
<?php $filePath = $frame->getFile(); ?>
<?php if($filePath && $editorHref = $handler->getEditorHref($filePath, (int) $line)): ?>
<a href="<?php echo $editorHref ?>" class="editor-link">
<span class="editor-link-callout">open:</span> <strong><?php echo $tpl->escape($filePath ?: '<#unknown>') ?></strong>
</a>
<?php else: ?>
<strong><?php echo $tpl->escape($filePath ?: '<#unknown>') ?></strong>
<?php endif ?>
</div>
<?php
// Do nothing if there's no line to work off
if($line !== null):

// the $line is 1-indexed, we nab -1 where needed to account for this
$range = $frame->getFileLines($line - 8, 10);

// getFileLines can return null if there is no source code
if ($range):
$range = array_map(function($line){ return empty($line) ? ' ' : $line;}, $range);
$start = key($range) + 1;
$code = join("\n", $range);
?>
<pre class="code-block prettyprint linenums:<?php echo $start ?>"><?php echo $tpl->escape($code) ?></pre>
<?php endif ?>
<?php endif ?>

<?php
// Append comments for this frame
$comments = $frame->getComments();
?>
<div class="frame-comments <?php echo empty($comments) ? 'empty' : '' ?>">
<?php foreach($comments as $commentNo => $comment): ?>
<?php extract($comment) ?>
<div class="frame-comment" id="comment-<?php echo $i . '-' . $commentNo ?>">
<span class="frame-comment-context"><?php echo $tpl->escape($context) ?></span>
<?php echo $tpl->escapeButPreserveUris($comment) ?>
</div>
<?php endforeach ?>
</div>

</div>
<?php endforeach ?>
</div>

0 comments on commit a862125

Please sign in to comment.