#19589 closed defect (bug) (fixed)
Simplify the recording of backtraces
Reported by: | westi | Owned by: | westi |
---|---|---|---|
Milestone: | 3.4 | Priority: | normal |
Severity: | normal | Version: | 3.3 |
Component: | Warnings/Notices | Keywords: | early has-patch |
Focuses: | Cc: |
Description
We currently have a simple backtrace generator in wpdb::get_caller which doesn't always tell the complete truth (e.g. when object methods are called statically this is not shown) and is limited to use from the wpdb object.
We should have a more generic function available in core which wpdb and plugins (like debug bar can use)
Attachments (1)
Change History (8)
#4
follow-up:
↓ 5
@
13 years ago
I think it would be better for the function to return an array that can then be imploded. For example someone may wish to turn this into a list, or reverse it first, before printing it. The comma is a bit hard-coded in.
Beyond that, +1.
#5
in reply to:
↑ 4
@
13 years ago
Replying to nacin:
I think it would be better for the function to return an array that can then be imploded. For example someone may wish to turn this into a list, or reverse it first, before printing it. The comma is a bit hard-coded in.
Beyond that, +1.
I specifically avoided returning the array for a number of reasons:
- I was trying to refactor the code out of WPDB and make it more generally usable so wanted it to be a drop-in replacement in terms of functionality
- I wanted to encourage consistent display and ordering of the data across use-cases - so that you can look at the displayed trace and see it exactly.
- When you display the backtrace not imploded you want to display more info like line numbers now you have the space for them
However, I can see that adding a 3rd argument $pretty
which defaults to true and current behaviour and otherwise returns the array if false is a simple and clean thing to do so I'm not averse to doing it and will include it.
Implementation of a new wp_debug_backtrace_summary() function