Questions tagged [debug-backtrace]

debug_backtrace() is a PHP function that prints the backtrace.

debug_backtrace() is a PHP function that prints the backtrace. A backtrace is a summary of how your program got where it is. It shows one line per call, for many calls, starting with the currently executing call (call zero), followed by its caller (call one), and on up the stack.

67 questions
3
votes
3 answers

Is debug_backtrace() safe for serious usage in production environment?

It's functionality is so strong that I worry about its stability and performance. What do you think? UPDATE What I'm doing is this: $old_dir = getcwd(); chdir( dirname($included_file) ); include ( $included_file ); chdir( $old_dir…
user198729
  • 61,774
  • 108
  • 250
  • 348
3
votes
2 answers

How to disable object providing in debug_backtrace?

How to disable object providing with debug_backtrace in PHP 5.2.11? debug_backtrace(false) didn't work. Thanks in advance, Simon
Simon
  • 594
  • 2
  • 6
  • 25
2
votes
3 answers

Why Does This Perform Better?

So I'm trying to implement an Aspect-Oriented Design into my architecture using debug_backtrace and PHP reflection. The design works but I decided to see just how badly it impacts performance so I wrote up the following profiling test. The…
Godwin
  • 9,739
  • 6
  • 40
  • 58
2
votes
0 answers

debug_backtrace() missing late bindings of class name

Suppose this scenario: class B extend class A and there is a method "myMethod" defined in class A. Inside myMethod I need to know the method name Using __METHOD__ always return the "className::" part referred to A A::myMethod My solution…
sdotbertoli
  • 131
  • 1
  • 4
2
votes
1 answer

How to debug a crashed Linux program by its glibc/malloc backtrace (no core available)?

I've a C++ application running on a remote server. I recently introduced a lot of new code. Fearing crashes, I had set ulimit -c unlimited and some time later I got a crash, with a coredump, which helped me debug a problem. For business reasons, the…
anrieff
  • 619
  • 1
  • 6
  • 15
2
votes
1 answer

PHP - debug_backtrace() crashes - what can I do?

I looked at the messages I could find, but didn't find an answer that appears to help. I have a routine that calls debug_backtrace() and then cycles through the elements, outputting them in a nice format for my log. This works fine in most cases. …
JustMeToo
  • 325
  • 1
  • 14
2
votes
2 answers

debug_print_backtrace doesn't work

I have PHP 5.3.4 and when I try to use debug_print_backtrace, I don't get anything. When I use vardump, I get an empty array, as you can see below. index.php:
Arlen Beiler
  • 15,336
  • 34
  • 92
  • 135
2
votes
1 answer

Can you resolve late static bindings out of scope in PHP?

I finally found myself learning about scope and context, and the difference between them, but now I'm having problems. I have a static method in a parent class that's inherited by a child class. When I call the method from the child, I want to be…
Jared Brandt
  • 203
  • 1
  • 7
2
votes
0 answers

Find diff of two stack traces / "relative stack trace" in PHP?

In PHP you can get a stack trace array from \Exception::getTrace() or from debug_backtrace(). Two stack traces within the same process / request typically have some calls in common, and then some calls that are separate. Or sometimes one stack trace…
donquixote
  • 4,877
  • 3
  • 31
  • 54
2
votes
1 answer

Is it okay to debug_backtrace as part of a non-debugging function?

I am trying to execute a function only if its called from a particular parent (or grandparent function, or great-grandparent, etc). I can achieve what I want to do using debug_backtrace, but I feel like this is not the correct way to do this. Take…
2
votes
0 answers

debug_backtrace() fails while in output buffering callback

Recently, an application echoed certain stuff at a random point of execution. Finding the exact statement turned out to be a problem: Too many statements emitted stuff. Thefore, I registered a callback via ob_start() to let the callback echo a…
SteAp
  • 11,853
  • 10
  • 53
  • 88
2
votes
2 answers

PHP: friend classes and ungreedy caller function/class

Is there any way to get the caller function with something else than debug_backtrace()? I'm looking for a less greedy way to simulate scopes like friend or internal. Let's say I have a class A and a class B. Until now, I've been using…
avetisk
  • 11,651
  • 4
  • 24
  • 37
2
votes
1 answer

PHP, Auto SQL comment, database debugging which file and line called the sql

We have a large php application and trying to debugging slow sql queries, we'd like to have the ability to auto comment what file actually called the sql query, something like: "select /* filename.php line 234*/ `ID`,`Email`, `NickName`,…
TroyWorks
  • 411
  • 8
  • 16
2
votes
1 answer

Enable full backtrace-logging in production

I am getting an error only in production and to debug that, I would like to enable full backtracing in production. I already have config.log_level = :debug in config/environments/production.rb, but that does not give me a backtrace, only logs the…
berkes
  • 26,996
  • 27
  • 115
  • 206
1
vote
2 answers

Explanation of what this backtrace is telling me

I've got a program, randomly when a device disconnects or connects I get a crash. when I run a bt command in gdb I get the following: #0 0x00007fff881cf150 in objc_msgSend_vtable5 () #1 0x00007fff8cceabf3 in…
Justin808
  • 20,859
  • 46
  • 160
  • 265