Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for backtraces with poorly specified PHP behavior #4

Closed
wants to merge 1 commit into from
Closed

Fixes for backtraces with poorly specified PHP behavior #4

wants to merge 1 commit into from

Conversation

yinonbentor
Copy link

Sometimes, PHP does not provide a line number and filename in a
debug_backtrace(), including cases where call_user_function() is used.
We must supply fake values, since the function name is still useful to log.

Also, in an Exception's getTrace(), the first frame does not include
a line and filename, but that information can be retrieved from the Exception's
getFile() and getLine() methods.

Lastly, since debug_backtrace() will always include the erroring line,
don't force include it, to avoid an inaccurate and misleading stack trace.

Sometimes, PHP does not provide a line number and filename in a
debug_backtrace(), including cases where call_user_function() is used.
We must supply fake values, since the function name is still useful to log.

Also, in an Exception's getTrace(), the first frame does not include
a line and filename, but that information can be retrieved from the Exception's
getFile() and getLine() methods.

Lastly, since debug_backtrace() will always include the erroring line,
don't force include it, to avoid an inaccurate and misleading stack trace.
brianr pushed a commit that referenced this pull request Oct 2, 2012
- fixed position of "top level" frame in the backtrace
- reverse backtrace so it's in the order Ratchet expects it
- new config variable: shift_function. When true (the default), function names are shifted down one level in the trace so that they reflect the context of the call, as Ratchet expects and most other langauges do.
- fix notice when $frame['line'] or $frame['file'] is missing.

Also bumping version number to 0.3.1.
@brianr
Copy link
Member

brianr commented Oct 2, 2012

Thanks for this.

While reviewing this changeset, I noticed that there were some other problems with the order of the frames in the backtraces. I've incorporated your changes and made a few additional changes that I think put the frames in the most logical order. See this commit: ratchetio@ce2b153

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants