Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Stack trace order is backwards #2044
The order in which stack traces are displayed by php-unit is backwards compared with php's own error and exception stack traces - for example, error and exception stack traces look like this in php 7.0:
Given that stack traces generated by php itself (as well as by most other languages) are displayed head-first, I suggest reversing the stack trace print-outs for consistency with, well, everything else.
Note that I'm aware that the stack trace order is consistent with that of xdebug. However, it too is inconsistent with php itself, as is clear from the second print-out on this page, where you actually see two stack-tracks in opposing order on screen at the same time. I have reported that issue against xdebug as well.
While you can argue in favor of one direction or the other, those arguments, in my opinion, are nowhere near as important as mere consistency - the mental switch required to read stack traces in opposing orders costs time. Even if you don't care about being consistent with other languages, it's tough to argue for inconsistency with php itself, and probably with JS, which most PHP developers use too.
@sebastianbergmann any thoughts on this?
@derickr doesn't feel like fixing it, but I'm hoping maybe you feel differently - and that he might change his mind, if you decide to correct php-unit.
This inconsistency is hugely distracting, and it doesn't get better with experience. I wish everyone (php-unit, codeception, xdebug) would just agree on what a stack trace looks like and stick with it. Aligning with php itself would seem like the natural thing to do.
If you don't feel like doing the work either, let me know if you'd accept a PR...