Monday, 10 September 2018

PHP internals - what error logging function to use?

I'm writing a PHP extension (although its starting to look a lot like a zend extension). There are instances where it needs to write to a logging interface.

I see that zend_error() is being used elsewhere however:

  • reading the source code on github I found zend_error declared in zend/zend.h but I couldn't find the corresponding definition of the function

  • looking at the contexts in which zend_error is used, I suspect that calls will be rerouted/diverted by set_error_handler

Normally, the logging will happen in MINIT and MSHUTDOWN (where presumably an error handler defined by a script cannot have any influence) but there may be times in between as well - and I'm looking for some consistency. Hence trying to understand how the mechanism works.

Is it safe to use zend_error() in MINIT/MSHUTDOWN?

How do I ensure that I am always calling the the default error handler?



from PHP internals - what error logging function to use?

No comments:

Post a Comment