Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Free reserved memory before handling fatal errors (#42630)
When the PHP process exceeds the configured memory limit, a fatal error such as the following occurs: ``` Allowed memory size of 1073741824 bytes exhausted (tried to allocate 3358976 bytes) ``` Currently, the process abruptly exits in such cases without and indication as to what has caused the error. This is because the handler from `register_shutdown_function()` attempts to instantiate a `FatalError` instance, thus trying to use memory that is not available. This clears the reserved memory before this instantiation, thus ensuring that the process has enough memory to properly handle the error. Reserved memory is also cleared in `handleException` in the same way.
- Loading branch information