Page MenuHomePhabricator

DebugHelper - figure out why it's hitting out of memory issues
Closed, ResolvedPublic

Event Timeline

stwalkerster removed a project: Restricted Project.

So, it turns out that PHPUnit_Extensions_MockFunction uses debug_backtrace() internally, thus using PHPUnit_Extensions_MockFunction to mock debug_backtrace() actually causes a nice little recursive loop.

Fixing

Add a new method to DebugHelper which simply does return debug_backtrace();. This will need to be static because we don't have instances of the class around. Make it private if you can sensibly - remember you can use reflection to change the visibility if you need to make it visible just for the unit test - I leave this to you.

Modify DebugHelper::getBacktrace() to call the new method instead of calling debug_backtrace().

The extra method call before calling debug_backtrace() will probably cause the exception handler to show up on the backtraces, which we don't want. I suspect the following block of code will need to be modified to skip two backtrace frames instead of just one:

if ($count == 0) {
    $count++;
    continue;
}