Skip to content
Snippets Groups Projects
Commit 0d77fa57 authored by catch's avatar catch
Browse files

Issue #2688615 by rballou, dawehner: Add the file to Error::formatBacktrace()

parent 9d5b5a53
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -177,7 +177,11 @@ public static function formatBacktrace(array $backtrace) {
$line = '';
if (isset($trace['line'])) {
$line = " (Line: {$trace['line']})";
$line = " (Line: {$trace['line']}";
if (isset($trace['file'])) {
$line .= ':' . $trace['file'];
}
$line .= ")";
}
$return .= $call['function'] . '(' . implode(', ', $call['args']) . ")$line\n";
......
......@@ -84,28 +84,28 @@ public function providerTestFormatBacktrace() {
$data = array();
// Test with no function, main should be in the backtrace.
$data[] = array(array($this->createBacktraceItem(NULL, NULL)), "main() (Line: 10)\n");
$data[] = array(array($this->createBacktraceItem(NULL, NULL)), "main() (Line: 10:test_file)\n");
$base = array($this->createBacktraceItem());
$data[] = array($base, "test_function() (Line: 10)\n");
$data[] = array($base, "test_function() (Line: 10:test_file)\n");
// Add a second item.
$second_item = $base;
$second_item[] = $this->createBacktraceItem('test_function_2');
$data[] = array($second_item, "test_function() (Line: 10)\ntest_function_2() (Line: 10)\n");
$data[] = array($second_item, "test_function() (Line: 10:test_file)\ntest_function_2() (Line: 10:test_file)\n");
// Add a second item, with a class.
$second_item_class = $base;
$second_item_class[] = $this->createBacktraceItem('test_function_2', 'TestClass');
$data[] = array($second_item_class, "test_function() (Line: 10)\nTestClass->test_function_2() (Line: 10)\n");
$data[] = array($second_item_class, "test_function() (Line: 10:test_file)\nTestClass->test_function_2() (Line: 10:test_file)\n");
// Add a second item, with a class.
$second_item_args = $base;
$second_item_args[] = $this->createBacktraceItem('test_function_2', NULL, array('string', 10, new \stdClass()));
$data[] = array($second_item_args, "test_function() (Line: 10)\ntest_function_2('string', 10, Object) (Line: 10)\n");
$data[] = array($second_item_args, "test_function() (Line: 10:test_file)\ntest_function_2('string', 10, Object) (Line: 10:test_file)\n");
return $data;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment