function main() { pure_function_2(1, 2); fb_setprofile('profiler'); pure_function_2(3, 4); fb_setprofile(null); pure_function_2(5, 6); }
function test() { fb_setprofile('handler'); try { new X(); } catch (Exception $e) { echo "ok\n"; } }
function main() { pure_function_2(1, 2); fb_setprofile('profiler'); pure_function_2(3, 4); srand(0xdeadbeef); try { test_exception(); } catch (Exception $e) { //do nothing. } foreach (gen() as $x) { } fb_setprofile(null); pure_function_2(5, 6); }
if ($name == 'get_class') { return; } if ($event == 'exit') { --$indent; } printf("\n%s%s %s: %s\n", str_repeat(' ', $indent), $event, $name, serialize($info)); if ($event == 'enter') { ++$indent; } static $threw = false; if ($event == 'exit' && (!$threw && strncmp('C::', $name, 3) == 0 || $name === 'C::method')) { $threw = true; throw new Exception($name); } } fb_setprofile('profiler'); function main() { try { new C(); } catch (Exception $e) { echo "\nCaught " . $e->getMessage() . "\n"; } try { (new C())->method(); } catch (Exception $e) { echo "\nCaught " . $e->getMessage() . "\n"; } } main();
function main() { // Test throwing on function entry fb_setprofile('throwing_profiler'); try { foo('bar'); } catch (Exception $x) { echo "Caught\n"; } try { foo('baz'); } catch (Exception $x) { echo "Caught\n"; } fb_setprofile(null); // Test throwing exceptions from surprise flags things (OOM, signals, // and req timeout all work this way). pcntl_signal(10, 'signal_thrower'); try { func_entry(); } catch (Exception $x) { echo "caught\n"; } try { func_backward(); } catch (Exception $x) { echo "caught\n"; } }
function foo() { fb_setprofile('throwing_profiler'); bar(); }
<?php function fb_setprofile_callback3($event, $name, $info) { echo "fb_setprofile_callback3 event=", $event, " name=", $name, " info=", $info, "\n"; } function fb_setprofile_callback2($event, $name) { echo "fb_setprofile_callback2 event=", $event, " name=", $name, "\n"; } function fb_setprofile_callback1($event) { echo "fb_setprofile_callback1 event=", $event, "\n"; } fb_setprofile("fb_setprofile_callback1"); $x = false; echo "x="; var_dump($x); $algos = "none"; echo "starting call to hash_init\n"; if (true) { $hash = hash_init('md5'); } echo "hash="; var_dump($hash); echo "DONE!\n";
<?php class X { private $m; function __construct($m) { $this->m = $m; } } function prof($what, $fn) { if ($what == 'exit' && $fn == 'main') { throw new Exception("Surprise"); } } function main() { return new X(null); } try { fb_setprofile('prof'); var_dump(main()); } catch (Exception $e) { var_dump($e->getMessage()); }
<?php # bug #2088495 function asd($x, $y) { if ($x == 'exit' && $y == 'foo') { echo "yep\n"; throw new Exception('yo'); } echo "hi {$x} {$y}\n"; } fb_setprofile('asd'); function foo() { $x = new stdclass(); $y = new stdclass(); $z = new stdclass(); return new stdclass(); } try { foo(); } catch (Exception $x) { echo $x->getMessage() . "\n"; }