Arquivos
hhvm/hphp/test/vm/nested_vm_exceptions2.php
T
Jordan Delong 363d1bb20f Code move src/ -> hphp/
This change is mostly for FB internal organizational reasons.
Building is not effected beyond the fact that the target now
lands in hphp/hhvm/hhvm rather than src/hhvm/hhvm.
2013-02-11 02:10:41 -08:00

31 linhas
703 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) {
// Cause an undefined variable warning, and throw from the user
// error handler.
$x = $z;
}
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));