From f1702d2bb1a8431e289a6ce9e7fc2734dc6e305c Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Sat, 1 Feb 2025 14:57:39 +0100 Subject: [PATCH 1/2] Suppress MSVC C4995 warnings (deprecations) These have the same meaning as C4996[1] (which we already suppress), but are triggered by a different mechanism[2]. It makes no sense to suppress one, but not both. Of course it would be better not to suppress either, but wrt the two C4995 warnings we see in php-src, that requires deprecation of using the ODBC cursor library[3], so might take a while. [1] [2] [3] Closes GH-17664. --- win32/build/confutils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/win32/build/confutils.js b/win32/build/confutils.js index 5a03ea1020594..0f97a1a2d29c6 100644 --- a/win32/build/confutils.js +++ b/win32/build/confutils.js @@ -3269,9 +3269,9 @@ function toolset_setup_common_cflags() // disable annoying warnings. In addition, time_t defaults // to 64-bit. Ask for 32-bit. if (TARGET_ARCH == 'x86') { - ADD_FLAG('CFLAGS', ' /wd4996 /D_USE_32BIT_TIME_T=1 '); + ADD_FLAG('CFLAGS', ' /wd4995 /wd4996 /D_USE_32BIT_TIME_T=1 '); } else { - ADD_FLAG('CFLAGS', ' /wd4996 '); + ADD_FLAG('CFLAGS', ' /wd4995 /wd4996 '); } if (PHP_DEBUG == "yes") { From e306a2e0e88e6c641b4a2ae352b4f8cd13a99376 Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Sat, 1 Feb 2025 23:57:37 +0100 Subject: [PATCH 2/2] Add missing NULL checks in dbstmt_get_gc This fixes the nightly Laravel failure: https://github.com/php/php-src/actions/runs/13083746886/job/36512023794 --- ext/pdo/pdo_stmt.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index bf7936f94521d..0b779f6562781 100644 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -1965,9 +1965,13 @@ static HashTable *dbstmt_get_gc(zend_object *object, zval **gc_data, int *gc_cou enum pdo_fetch_type default_fetch_mode = stmt->default_fetch_type & ~PDO_FETCH_FLAGS; zend_get_gc_buffer *gc_buffer = zend_get_gc_buffer_create(); - zend_get_gc_buffer_add_obj(gc_buffer, stmt->database_object_handle); + if (stmt->database_object_handle) { + zend_get_gc_buffer_add_obj(gc_buffer, stmt->database_object_handle); + } if (default_fetch_mode == PDO_FETCH_INTO) { - zend_get_gc_buffer_add_obj(gc_buffer, stmt->fetch.into); + if (stmt->fetch.into) { + zend_get_gc_buffer_add_obj(gc_buffer, stmt->fetch.into); + } } else if (default_fetch_mode == PDO_FETCH_CLASS && stmt->fetch.cls.ctor_args != NULL) { zend_get_gc_buffer_add_ht(gc_buffer, stmt->fetch.cls.ctor_args); }