Header hook/unhook improvement.

This commit fixes hooking procedure and stops xdebug from crashing Apache 2.4 SAPI when another zend extension (like suhosin) overrides the output/header handlers.

Feel free to release this fix in the new maintenance version.

Regards,
NewEraCracker.