diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 4cb9386eed17b..7335baf849d5e 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -2290,7 +2290,10 @@ void zend_mm_shutdown(zend_mm_heap *heap, bool full, bool silent) #if ZEND_DEBUG if (!silent) { - zend_mm_check_leaks(heap); + char *tmp = getenv("ZEND_ALLOC_PRINT_LEAKS"); + if (!tmp || ZEND_ATOL(tmp)) { + zend_mm_check_leaks(heap); + } } #endif diff --git a/ext/gettext/tests/bug53251.phpt b/ext/gettext/tests/bug53251.phpt index 6f37642925d37..e005766f3a86b 100644 --- a/ext/gettext/tests/bug53251.phpt +++ b/ext/gettext/tests/bug53251.phpt @@ -4,7 +4,7 @@ Bug #53251 (bindtextdomain with null dir doesn't return old value) gettext --SKIPIF-- --FILE-- wrapCommand($cmd, $memcheck_filename, strpos($test_file, "pcre") !== false); } - if ($test->hasSection('XLEAK') && isset($env['SKIP_ASAN'])) { - $env['LSAN_OPTIONS'] = 'detect_leaks=0'; + if ($test->hasSection('XLEAK')) { + $env['ZEND_ALLOC_PRINT_LEAKS'] = '0'; + if (isset($env['SKIP_ASAN'])) { + $env['LSAN_OPTIONS'] = 'detect_leaks=0'; + } } if ($DETAILED) { @@ -2664,7 +2667,7 @@ function run_test(string $php, $file, array $env): string if ($test->hasSection('XFAIL')) { $warn = true; $info = " (warn: XFAIL section but test passes)"; - } elseif ($test->hasSection('XLEAK') && !isset($env['SKIP_ASAN'])) { + } elseif ($test->hasSection('XLEAK') && $valgrind) { // XLEAK with ASAN completely disables LSAN so the test is expected to pass $warn = true; $info = " (warn: XLEAK section but test passes)"; @@ -2702,7 +2705,7 @@ function run_test(string $php, $file, array $env): string if ($test->hasSection('XFAIL')) { $restype[] = 'XFAIL'; $info = ' XFAIL REASON: ' . rtrim($test->getSection('XFAIL')); - } elseif ($test->hasSection('XLEAK') && !isset($env['SKIP_ASAN'])) { + } elseif ($test->hasSection('XLEAK') && $valgrind) { // XLEAK with ASAN completely disables LSAN so the test is expected to pass $restype[] = 'XLEAK'; $info = ' XLEAK REASON: ' . rtrim($test->getSection('XLEAK'));