Skip to content

Commit de6e401

Browse files
authored
Use common formatting for backtraces (php#6977)
This makes debug_print_backtrace() use the same formatting as exception backtraces. The only difference is that the final #{main} is omitted, because it wouldn't make sense for limited backtraces, and wasn't there previously either.
1 parent 1c8bb6d commit de6e401

23 files changed

+129
-171
lines changed

Zend/tests/attributes/031_backtrace.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ class Test {}
1919

2020
?>
2121
--EXPECTF--
22-
#0 MyAttribute->__construct() called at [%s031_backtrace.php:12]
23-
#1 ReflectionAttribute->newInstance() called at [%s:%d]
22+
#0 %s031_backtrace.php(12): MyAttribute->__construct()
23+
#1 %s(%d): ReflectionAttribute->newInstance()
2424
array(2) {
2525
[0]=>
2626
array(7) {

Zend/tests/bug29896.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ function GenerateError2($A1)
2222
GenerateError2("Test2");
2323
?>
2424
--EXPECTF--
25-
#0 userErrorHandler(2, Undefined variable $b, %s, %d) called at [%s:%d]
26-
#1 GenerateError1(Test1) called at [%sbug29896.php:16]
27-
#2 GenerateError2(Test2) called at [%sbug29896.php:19]
25+
#0 %s(%d): userErrorHandler(2, 'Undefined varia...', '%s', %d)
26+
#1 %s(%d): GenerateError1('Test1')
27+
#2 %s(%d): GenerateError2('Test2')

Zend/tests/bug30828.phpt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ $b->foo();
4747
B::bar();
4848
?>
4949
--EXPECTF--
50-
#0 A->__construct() called at [%sbug30828.php:30]
51-
#1 B->__construct() called at [%sbug30828.php:42]
50+
#0 %sbug30828.php(30): A->__construct()
51+
#1 %sbug30828.php(42): B->__construct()
5252
A->__construct
5353
B->__construct
54-
#0 A->foo() called at [%sbug30828.php:34]
55-
#1 B->foo() called at [%sbug30828.php:43]
54+
#0 %sbug30828.php(34): A->foo()
55+
#1 %sbug30828.php(43): B->foo()
5656
A->foo
5757
B->foo
58-
#0 A::bar() called at [%sbug30828.php:38]
59-
#1 B::bar() called at [%sbug30828.php:44]
58+
#0 %sbug30828.php(38): A::bar()
59+
#1 %sbug30828.php(44): B::bar()
6060
A::bar
6161
B::bar

Zend/tests/bug64239_3.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ $c->Bmethod();
2727
$c->t2method();
2828
?>
2929
--EXPECTF--
30-
#0 A->Bmethod() called at [%sbug64239_3.php:%d]
31-
#0 A->t2method() called at [%sbug64239_3.php:%d]
32-
#0 C->Bmethod() called at [%sbug64239_3.php:%d]
33-
#0 A->t2method() called at [%sbug64239_3.php:%d]
30+
#0 %s(%d): A->Bmethod()
31+
#0 %s(%d): A->t2method()
32+
#0 %s(%d): C->Bmethod()
33+
#0 %s(%d): A->t2method()

Zend/tests/bug64239_4.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ C::Bmethod();
2525
C::t2method();
2626
?>
2727
--EXPECTF--
28-
#0 A::Bmethod() called at [%sbug64239_4.php:%d]
29-
#0 A::t2method() called at [%sbug64239_4.php:%d]
30-
#0 C::Bmethod() called at [%sbug64239_4.php:%d]
31-
#0 A::t2method() called at [%sbug64239_4.php:%d]
28+
#0 %s(%d): A::Bmethod()
29+
#0 %s(%d): A::t2method()
30+
#0 %s(%d): C::Bmethod()
31+
#0 %s(%d): A::t2method()

Zend/tests/bug70156.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ class dummy {
3232
new dummy();
3333
?>
3434
--EXPECTF--
35-
#0 dummy->bar() called at [%sbug70156.php:%d]
36-
#1 dummy->foo1() called at [%sbug70156.php:%d]
37-
#2 dummy->__construct() called at [%sbug70156.php:%d]
35+
#0 %s(%d): dummy->bar()
36+
#1 %s(%d): dummy->foo1()
37+
#2 %s(%d): dummy->__construct()

Zend/tests/bug73916.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ function test() {
1313
}
1414
?>
1515
--EXPECTF--
16-
#0 test(Array ([0] => Array ([0] => a),[1] => b Object ())) called at [%sbug73916.php:%d]
16+
#0 %s(%d): test(Array)

Zend/tests/bug78973.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ test(new class {
1515

1616
?>
1717
--EXPECTF--
18-
#0 class@anonymous->__destruct() called at [%s:%d]
18+
#0 %s(%d): class@anonymous->__destruct()

Zend/tests/bug_debug_backtrace.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ eval("foo();");
1919
echo "Done\n";
2020
?>
2121
--EXPECTF--
22-
#0 boo() called at [%s:%d]
23-
#1 bar() called at [%s:%d]
24-
#2 foo() called at [%s(%d) : eval()'d code:1]
25-
#3 eval() called at [%s:%d]
22+
#0 %s(%d): boo()
23+
#1 %s(%d): bar()
24+
#2 %s(%d) : eval()'d code(1): foo()
25+
#3 %s(%d): eval()
2626
Done

Zend/tests/closure_032.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Array
2929
)
3030

3131
)
32-
#0 {closure}(23) called at [%s:%d]
32+
#0 %s(%d): {closure}(23)
3333
Array
3434
(
3535
[0] => Array
@@ -65,5 +65,5 @@ Array
6565
)
6666

6767
)
68-
#0 {closure}(23) called at [%s:%d]
69-
#1 test(Closure Object ()) called at [%s:%d]
68+
#0 %s(%d): {closure}(23)
69+
#1 %s(%d): test(Object(Closure))

0 commit comments

Comments
 (0)