From 40918acf152072d9920d0d94486055dd827e23ee Mon Sep 17 00:00:00 2001 From: Jenny Tam Date: Fri, 9 Nov 2018 11:50:01 -0800 Subject: [PATCH 1/3] Added the compiler flag, /Qspectre --- source/pdo_sqlsrv/config.w32 | 7 ++++++- source/sqlsrv/config.w32 | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/source/pdo_sqlsrv/config.w32 b/source/pdo_sqlsrv/config.w32 index cd6e3a063..6ab43ebfd 100644 --- a/source/pdo_sqlsrv/config.w32 +++ b/source/pdo_sqlsrv/config.w32 @@ -38,7 +38,12 @@ if( PHP_PDO_SQLSRV != "no" ) { ADD_FLAG( "CFLAGS_PDO_SQLSRV", "/D ZEND_WIN32_FORCE_INLINE" ); if (VCVERS >= 1913) { ADD_FLAG("CFLAGS_PDO_SQLSRV", "/Qspectre"); - } + } else if (VCVERS == 1900) { + var subver1900 = probe_binary(PHP_CL).substr(6); + if (subver1900 >= 24241) { + ADD_FLAG('CFLAGS_PDO_SQLSRV', "/Qspectre"); + } + } ADD_EXTENSION_DEP('pdo_sqlsrv', 'pdo'); EXTENSION("pdo_sqlsrv", pdo_sqlsrv_src_class, PHP_PDO_SQLSRV_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"); } else { diff --git a/source/sqlsrv/config.w32 b/source/sqlsrv/config.w32 index b6c2b1b1a..33203f448 100644 --- a/source/sqlsrv/config.w32 +++ b/source/sqlsrv/config.w32 @@ -37,7 +37,12 @@ if( PHP_SQLSRV != "no" ) { ADD_FLAG( "CFLAGS_SQLSRV", "/Zi" ); if (VCVERS >= 1913) { ADD_FLAG("CFLAGS_SQLSRV", "/Qspectre"); - } + } else if (VCVERS == 1900) { + var subver1900 = probe_binary(PHP_CL).substr(6); + if (subver1900 >= 24241) { + ADD_FLAG('CFLAGS_SQLSRV', "/Qspectre"); + } + } if (PHP_DEBUG != "yes") ADD_FLAG( "CFLAGS_SQLSRV", "/guard:cf /O2" ); EXTENSION("sqlsrv", sqlsrv_src_class , PHP_SQLSRV_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"); } else { From a4adac20da378e452d4da95c8fc204a9fb0f7ddc Mon Sep 17 00:00:00 2001 From: Jenny Tam Date: Fri, 9 Nov 2018 14:56:28 -0800 Subject: [PATCH 2/3] Fixed 7.2 version in appveyor for now --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 4a0fcbddd..ee9f2eb37 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -24,7 +24,7 @@ environment: SQL_INSTANCE: SQL2017 PHP_VC: 15 PHP_MAJOR_VER: 7.2 - PHP_MINOR_VER: latest + PHP_MINOR_VER: 11 PHP_EXE_PATH: x64\Release_TS THREAD: ts platform: x64 From 01e723015b74a14cb3bec87e10f6aa8b580e2154 Mon Sep 17 00:00:00 2001 From: Jenny Tam Date: Tue, 13 Nov 2018 09:50:00 -0800 Subject: [PATCH 3/3] Added linker flag too --- source/pdo_sqlsrv/config.w32 | 2 ++ source/sqlsrv/config.w32 | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/source/pdo_sqlsrv/config.w32 b/source/pdo_sqlsrv/config.w32 index 6ab43ebfd..8b8e4f29a 100644 --- a/source/pdo_sqlsrv/config.w32 +++ b/source/pdo_sqlsrv/config.w32 @@ -37,10 +37,12 @@ if( PHP_PDO_SQLSRV != "no" ) { if (PHP_DEBUG != "yes") ADD_FLAG( "CFLAGS_PDO_SQLSRV", "/guard:cf /O2" ); ADD_FLAG( "CFLAGS_PDO_SQLSRV", "/D ZEND_WIN32_FORCE_INLINE" ); if (VCVERS >= 1913) { + ADD_FLAG("LDFLAGS_PDO_SQLSRV", "/d2:-guardspecload"); ADD_FLAG("CFLAGS_PDO_SQLSRV", "/Qspectre"); } else if (VCVERS == 1900) { var subver1900 = probe_binary(PHP_CL).substr(6); if (subver1900 >= 24241) { + ADD_FLAG("LDFLAGS_PDO_SQLSRV", "/d2:-guardspecload"); ADD_FLAG('CFLAGS_PDO_SQLSRV', "/Qspectre"); } } diff --git a/source/sqlsrv/config.w32 b/source/sqlsrv/config.w32 index 33203f448..e4cd19d01 100644 --- a/source/sqlsrv/config.w32 +++ b/source/sqlsrv/config.w32 @@ -36,10 +36,12 @@ if( PHP_SQLSRV != "no" ) { ADD_FLAG( "CFLAGS_SQLSRV", "/GS" ); ADD_FLAG( "CFLAGS_SQLSRV", "/Zi" ); if (VCVERS >= 1913) { + ADD_FLAG("LDFLAGS_SQLSRV", "/d2:-guardspecload"); ADD_FLAG("CFLAGS_SQLSRV", "/Qspectre"); } else if (VCVERS == 1900) { var subver1900 = probe_binary(PHP_CL).substr(6); if (subver1900 >= 24241) { + ADD_FLAG("LDFLAGS_SQLSRV", "/d2:-guardspecload"); ADD_FLAG('CFLAGS_SQLSRV', "/Qspectre"); } } @@ -47,5 +49,5 @@ if( PHP_SQLSRV != "no" ) { EXTENSION("sqlsrv", sqlsrv_src_class , PHP_SQLSRV_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"); } else { WARNING("sqlsrv not enabled; libraries and headers not found"); - } + } }