register_shutdown_function only once

no matter how many times error handler is enabled or disabled,
register_shutdown_function is called once, otherwise multiple shutdown
function instances would be run, causing an error!
Merge branch 'master' of https://github.com/OWASP/phpsec
merge other code with mine