global statement removal: hphp/test [7/x]
[hiphop-php.git] / hphp / test / quick / nested_vm_exceptions.php
blob019ede6bdf250d82e8680db0699fe3b9146ce34d
1 <?hh
3 // Tests a case where prepareFuncEntry throws in a nested VM context.
5 function error_handler() {
6 echo "Error handler\n";
7 throw new Exception("unhandled exception");
9 set_error_handler('error_handler');
11 function binary_function(string $x, $y) {
14 try {
15 // Throw from the user error handler after raising a warning about
16 // arg count.
17 call_user_func_array('binary_function', array(12, 12));
18 } catch (Exception $x) {
19 echo "We hit our handler.\n";
20 throw new Exception("Sup");
23 // Try it with no catch also.
24 call_user_func_array('binary_function', array(12, 12));