public static function showCallStack() { echo 'CallStack - File: ' . xdebug_call_file(); echo '<br />Class: ' . xdebug_call_class(); echo '<br />Function: ' . xdebug_call_function(); echo '<br />Line: ' . xdebug_call_line(); echo '<br />Depth of Stacks: ' . xdebug_get_stack_depth(); echo '<br />Content of Stack: ' . xdebug_var_dump(xdebug_get_function_stack()); }
public function testDoesNotInfinitelyRecurse() { $client = new Client(['handler' => function () { throw new \RuntimeException('No network access'); }]); $last = null; $client->getEmitter()->on('before', function (BeforeEvent $e) use(&$last) { $e->intercept(new Response(200)); if (function_exists('xdebug_get_stack_depth')) { if ($last) { $this->assertEquals($last, xdebug_get_stack_depth()); } else { $last = xdebug_get_stack_depth(); } } }); $requests = []; for ($i = 0; $i < 100; $i++) { $requests[] = $client->createRequest('GET', 'http://foo.com'); } $pool = new Pool($client, $requests); $pool->wait(); }
<?php function foo($i) { echo "{$i}\n"; foo($i + 1); } $i = xdebug_get_stack_depth(); ini_set("xdebug.max_nesting_level", $i + 3); echo "{$i}\n"; foo($i + 1);
/** * Returns the stack depth level. * The main body of a script is level 0 and each include and/or function call adds one to the stack depth level. * @return int */ public function getStackDepth() { return xdebug_get_stack_depth(); }