3

Is there a simple way to trigger PHP shutdown so that error_get_last function returns a real error from within a function registered with register_shutdown_function. I need it to test my custom error handling and mailing functions under stress conditions.

2
  • Division by 0 perhaps? :) Commented Aug 22, 2013 at 9:03
  • 1
    @deceze It's not FORTRAN :P Commented Aug 22, 2013 at 9:11

2 Answers 2

2
trigger_error("You goin' down!", E_USER_ERROR); 
Sign up to request clarification or add additional context in comments.

Comments

1
<?php function shutdown() { echo "shutdown:\n"; print_r(error_get_last()); } register_shutdown_function('shutdown'); throw new Exception("fatal error"); print("END") 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.