Commit cf3c803b506 for php.net
commit cf3c803b506709c2af84c2be84e7746a97868a3e
Author: Florian Engelhardt <flo@dotbox.org>
Date: Wed Jul 8 12:21:58 2026 +0200
`abort()` in OOM case
Closes GH-22637
diff --git a/NEWS b/NEWS
index b2544cb5abd..2fa31ab34fd 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@ PHP NEWS
iterator). (iliaal)
. Lock unmodified readonly properties for modification after clone-with.
(NickSdot)
+ . abort() instead of exit() on hard OOM. (realFlowControl)
- Calendar:
. Fixed bug GH-22602 (gregoriantojd() and juliantojd() integer overflow with
diff --git a/UPGRADING b/UPGRADING
index a809687d196..729dfed0363 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -533,6 +533,10 @@ PHP 8.6 UPGRADE NOTES
13. Other Changes
========================================
+- Core:
+ . In case of a hard OOM PHP now calls abort() instead of exit(1), changing
+ the exit code to 134 and possibly creating a core dump.
+
========================================
14. Performance Improvements
========================================
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
index 0b040743abf..5ff2860d822 100644
--- a/Zend/zend_alloc.c
+++ b/Zend/zend_alloc.c
@@ -2974,7 +2974,7 @@ ZEND_API void refresh_memory_manager(void)
static ZEND_COLD ZEND_NORETURN void zend_out_of_memory(void)
{
fprintf(stderr, "Out of memory\n");
- exit(1);
+ abort();
}
#if ZEND_MM_CUSTOM