Arquivos
hhvm/hphp/test/quick/nested_vm_exceptions2.php
T
Mark Williams a2e46efe38 Make sure we raise a warning in repo mode
Repo mode can skip undefined variable warnings,
if they're known to be uninit at compile time, and eliminate
expressions whose only side effect might be to raise a
diagnostic.
2013-04-22 14:43:52 -07:00

31 linhas
698 B
PHP

<?php
// Similar to nested_vm_exceptions, except throw intercepted functions
// into it also.
function error_handler() {
echo "Error handler\n";
throw new Exception("unhandled exception");
}
set_error_handler('error_handler');
function unary_function($x) {
// Raise a warning and throw from
// the user error handler.
return UNDEFINED === $x;
}
function binary_function($x, $y) {}
fb_intercept('binary_function', 'unary_function', 'unary_function');
try {
call_user_func_array('binary_function', array(12));
} catch (Exception $x) {
echo "We hit our handler.\n";
throw new Exception("Sup");
}
// Try it with no catch also.
call_user_func_array('binary_function', array(12));