From 564830f7032134c097d5379f338c6a5bdab5363f Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Fri, 11 Oct 2024 18:26:35 +0200 Subject: [PATCH] Fix potentially erroneous php_win32_crt_compatible() Whether we link with a debug runtime or a normal runtime is not really related to `PHP_DEBUG`, but rather to `_DEBUG`[1]. We also stop defining that flag, since the compiler already does that. [1] --- win32/build/confutils.js | 2 +- win32/winutil.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/win32/build/confutils.js b/win32/build/confutils.js index c3b5ef9b29e40..c8678792fb075 100644 --- a/win32/build/confutils.js +++ b/win32/build/confutils.js @@ -3432,7 +3432,7 @@ function toolset_setup_common_libs() function toolset_setup_build_mode() { if (PHP_DEBUG == "yes") { - ADD_FLAG("CFLAGS", "/LDd /MDd /Od /D _DEBUG /D ZEND_DEBUG=1 " + + ADD_FLAG("CFLAGS", "/LDd /MDd /Od /D ZEND_DEBUG=1 " + (TARGET_ARCH == 'x86'?"/ZI":"/Zi")); ADD_FLAG("LDFLAGS", "/debug"); // Avoid problems when linking to release libraries that use the release diff --git a/win32/winutil.c b/win32/winutil.c index e09944d131b9b..e41bc899452f0 100644 --- a/win32/winutil.c +++ b/win32/winutil.c @@ -486,7 +486,7 @@ PHP_WINUTIL_API BOOL php_win32_crt_compatible(char **err) {/*{{{*/ #if PHP_LINKER_MAJOR == 14 /* Extend for other CRT if needed. */ -# if PHP_DEBUG +# ifdef _DEBUG const char *crt_name = "vcruntime140d.dll"; # else const char *crt_name = "vcruntime140.dll";