Arquivos
hhvm/hphp/test/ext/debugger_tests/flow_t.php
T
Paul Tarjan f5569e4755 clean up tests dir
I think this dir shouldn't have anything non-necessary in the root.
2013-06-06 16:31:09 -07:00

67 linhas
1.0 KiB
PHP

<?php
// Wanring: line numbers are sensitive, do not change
function foo($a, $b) {
$c = $b - $a;
error_log("foo:".$c);
}
class cls {
public function pub($x) {
error_log("in pub:".$x);
$this->pri($x);
error_log("out pub:".$x);
}
private function pri($x) {
error_log("in pri:".$x);
$y = $x + 3; $z = $x * 5;
foo($y, $z);
if ($x == 3) {
hphpd_break();
}
if ($x == 4) {
bigLoop(100000); // Slow enough that incorrect stepping will time out.
}
if ($x == 5 || $x == 6) {
baz($x);
}
error_log("out pri:".$x);
}
}
function bigLoopAdder($a, $b) {
return $a + $b;
}
function bigLoop($a) {
$b = 0;
while (--$a) {
$b += bigLoopAdder($a, $b);
}
return $b;
}
function thrower($a) {
throw new Exception();
}
function baz($a) {
try {
$a = thrower($a);
} catch (Exception $e) {
$a = 0;
}
return $a;
}
function test($x) {
error_log("test ".$x);
$obj = new cls();
$obj->pub($x);
error_log("test done ".$x);
}
error_log('flow_t.php loaded');