Fix incorrect context being used for excerpt.

Fixes #3064
This commit is contained in:
mark_story 2012-07-24 23:37:37 -04:00
parent 162d3bcb29
commit 70c714d600
2 changed files with 8 additions and 7 deletions

View file

@ -1,9 +1,5 @@
<?php <?php
/** /**
* DebuggerTest file
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
* *
@ -12,7 +8,6 @@
* *
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP Project * @link http://cakephp.org CakePHP Project
* @package Cake.Test.Case.Utility
* @since CakePHP(tm) v 1.2.0.5432 * @since CakePHP(tm) v 1.2.0.5432
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */

View file

@ -710,8 +710,14 @@ class Debugger {
$files = $this->trace(array('start' => $data['start'], 'format' => 'points')); $files = $this->trace(array('start' => $data['start'], 'format' => 'points'));
$code = ''; $code = '';
if (isset($files[1]['file'])) { $file = null;
$code = $this->excerpt($files[1]['file'], $files[1]['line'] - 1, 1); if (isset($files[0]['file'])) {
$file = $files[0];
} elseif (isset($files[1]['file'])) {
$file = $files[1];
}
if ($file) {
$code = $this->excerpt($file['file'], $file['line'] - 1, 1);
} }
$trace = $this->trace(array('start' => $data['start'], 'depth' => '20')); $trace = $this->trace(array('start' => $data['start'], 'depth' => '20'));
$insertOpts = array('before' => '{:', 'after' => '}'); $insertOpts = array('before' => '{:', 'after' => '}');