Skip to content

Commit 0cd3ebf

Browse files
committed
Fix 'phpdbg --help' segfault on shutdown with USE_ZEND_ALLOC=0
This hack not only breaks the handling of custom allocators, but also breaks if zend_alloc is compiled with USE_CUSTOM_MM. This hack is just no good, if you want leak information then use ASAN. Closes GH-18813.
1 parent fe3bea0 commit 0cd3ebf

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ PHP NEWS
3939
. Add missing filter cleanups on phar failure. (nielsdos)
4040
. Fixed bug GH-18642 (Signed integer overflow in ext/phar fseek). (nielsdos)
4141

42+
- PHPDBG:
43+
. Fix 'phpdbg --help' segfault on shutdown with USE_ZEND_ALLOC=0. (nielsdos)
44+
4245
- PDO ODBC:
4346
. Fix memory leak if WideCharToMultiByte() fails. (nielsdos)
4447

sapi/phpdbg/phpdbg.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,6 @@ static PHP_MSHUTDOWN_FUNCTION(phpdbg) /* {{{ */
179179
phpdbg_notice("Script ended normally");
180180
}
181181

182-
/* hack to restore mm_heap->use_custom_heap in order to receive memory leak info */
183-
if (use_mm_wrappers) {
184-
/* ASSUMING that mm_heap->use_custom_heap is the first element of the struct ... */
185-
*(int *) zend_mm_get_heap() = 0;
186-
}
187-
188182
if (PHPDBG_G(buffer)) {
189183
free(PHPDBG_G(buffer));
190184
PHPDBG_G(buffer) = NULL;

0 commit comments

Comments
 (0)