0

I need to perform some important operations in the destructor, so I want to know in which script termination scenarios the user-defined destructors are not called and I can't find it in the documentation.

Example:

  • unhandled exception - called
  • fatal error - not called
  • interpreter receives SIGTERM - called
  • interpreter receives SIGKILL - not called

etc...

  • 1
    Why do you need to run important operations in destructor instead of a regular code and do it when it is really needed and under your control? Especially in php when this is not a long running script and this is not about memory issue? Anyway here are some answers https://stackoverflow.com/questions/2385047/when-will-destruct-not-be-called-in-php – blahy Jul 30 '20 at 20:48
  • @blahy because I need to run it on object destruction. It's important but it's not a problem if it doesn't get executed sometimes. Thanks for pointing to the answer – Zhigalin - Reinstate CMs Aug 03 '20 at 07:02

0 Answers0