MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001259XdebugFeature/Change requestpublic2016-01-21 09:372018-11-29 14:41
Reportermindplay 
Assigned Toderick 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionwon't fix 
PlatformAny PHP versionOSAny OSOS Version
Product Version 
Target VersionFixed in Version 
Summary0001259: Stack trace print-outs in reverse order
DescriptionThe stack-trace print-outs are in backwards order compared with PHP itself, and compared with stack-traces in other languages, including Java and C#, as well as stack-trace print-outs in a JavaScript developer console.

It's very distracting and confusing to have to figure out the order of every stack trace you see during a day, and I'd like to request this be changed and made consistent with PHP itself.
Steps To ReproduceAn example stack trace from PHP 7 without xdebug:

<code>
Rasmus Schultz@Sidewinder-7240 MINGW64 /c
$ php -r "function foo() { throw new RuntimeException; } function bar() { foo(); } function baz() { bar(); } baz();"
PHP Fatal error: Uncaught RuntimeException in Command line code:1
Stack trace:
#0 Command line code(1): foo()
#1 Command line code(1): bar()
0000002 Command line code(1): baz()
0000003 {main}
  thrown in Command line code on line 1

Fatal error: Uncaught RuntimeException in Command line code:1
Stack trace:
#0 Command line code(1): foo()
#1 Command line code(1): bar()
0000002 Command line code(1): baz()
0000003 {main}
  thrown in Command line code on line 1
</code>

And an example stack trace with xdebug:

<code>
$ php -r "function foo() { throw new RuntimeException; } function bar() { foo(); } function baz() { bar(); } baz();"
PHP Fatal error: Uncaught RuntimeException in Command line code:1
Stack trace:
#0 Command line code(1): foo()
#1 Command line code(1): bar()
0000002 Command line code(1): baz()
0000003 {main}
  thrown in Command line code on line 1

Fatal error: Uncaught RuntimeException in Command line code on line 1

RuntimeException: in Command line code on line 1

Call Stack:
    0.0001 360720 1. {main}() Command line code:0
    0.0001 360720 2. baz() Command line code:1
    0.0001 360720 3. bar() Command line code:1
    0.0001 360720 4. foo() Command line code:1
</code>

In the latter case, we actually have two stack traces on screen at the same time, in opposing order - pretty confusing.
TagsNo tags attached.
Operating System
PHP Version7.0.0-7.0.4
Attached Files

- Relationships

-  Notes
(0003430)
mindplay (reporter)
2016-01-21 09:43

My example was mangled by Mantis, and it seems I can't edit this issue, so here's a readable gist with the examples:

https://gist.github.com/mindplay-dk/d50205f38f1d0cf3744f [^]
(0003431)
mindplay (reporter)
2016-01-21 10:10

Note that I have reported this issue against php-unit as well - likely taking inspiration from xdebug, php-unit also displays stack-traces in backwards order.

https://github.com/sebastianbergmann/phpunit/issues/2044 [^]
(0003459)
derick (administrator)
2016-02-08 21:12

Thanks for your request. I am not going to change this. It would render most tests invalid, all online docs and tutorials. Please just consider this a quirk of Xdebug (and PHP Unit).
(0004728)
vaxquis (reporter)
2018-11-29 14:24

@derick why can we just have a config var that would allow to reverse this, with a default setting equal to current, legacy behaviour? That way all the tests would be still valid, all the online docs and tutorials too.

Nb saying "please just consider this a quirk" about a behaviour that clearly violates POLA and differs from both platform (PHP's) and industry standards without providing any clear benefit to end-user is, to say the least, bizzare IMO.
(0004729)
derick (administrator)
2018-11-29 14:41

@vaxquis: PHP added stack traces after Xdebug had them for years, so PHP is inconsistent with Xdebug, if you must compare them.

It also wouldn't mean that "the tests would be still valid", as for each feature/setting, there need to be tests.

I'm not going to change this, nor add a configuration setting.

- Issue History
Date Modified Username Field Change
2016-01-21 09:37 mindplay New Issue
2016-01-21 09:43 mindplay Note Added: 0003430
2016-01-21 10:10 mindplay Note Added: 0003431
2016-02-08 21:12 derick Note Added: 0003459
2016-02-08 21:12 derick Status new => resolved
2016-02-08 21:12 derick Resolution open => won't fix
2016-02-08 21:12 derick Assigned To => derick
2018-11-29 14:24 vaxquis Note Added: 0004728
2018-11-29 14:41 derick Note Added: 0004729


Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker