@@ -232,12 +232,13 @@ sqlsrv_conn* core_sqlsrv_connect( _In_ sqlsrv_context& henv_cp, _In_ sqlsrv_cont
232232 }
233233 }
234234
235+ #ifdef ZTS
235236 // time to free the access token, if not null
236237 if (conn->azure_ad_access_token ) {
237238 memset (conn->azure_ad_access_token ->data , 0 , conn->azure_ad_access_token ->dataSize ); // clear the memory
238239 conn->azure_ad_access_token .reset ();
239240 }
240-
241+ # endif
241242 CHECK_SQL_ERROR ( r, conn ) {
242243 throw core::CoreException ();
243244 }
@@ -1165,7 +1166,7 @@ size_t core_str_zval_is_true(_Inout_ zval* value_z)
11651166 return 0 ; // false
11661167}
11671168
1168- #ifdef _WIN32
1169+ #if defined( _WIN32) && !defined(ZTS)
11691170ACCESSTOKEN** get_access_tokens () {
11701171#ifdef PDO_SQLSRV
11711172 return PDO_SQLSRV_G (access_tokens);
@@ -1204,7 +1205,7 @@ void access_token_set_func::func(_In_ connection_option const* option, _In_ zval
12041205 // similar to a UCS-2 string containing only ASCII characters
12051206 //
12061207 // See https://docs.microsoft.com/sql/connect/odbc/using-azure-active-directory#authenticating-with-an-access-token
1207- #ifdef _WIN32
1208+ #if defined( _WIN32) && !defined(ZTS)
12081209 size_t next_token_position = 0 ;
12091210 bool same_token_used = false ;
12101211 #ifdef PDO_SQLSRV
@@ -1249,14 +1250,14 @@ void access_token_set_func::func(_In_ connection_option const* option, _In_ zval
12491250 // Save the pointer because SQLDriverConnect() will use it to make connection to the server
12501251 conn->azure_ad_access_token = pAccToken;
12511252 accToken.transferred ();
1252- #ifdef _WIN32
1253+ #if defined( _WIN32) && !defined(ZTS)
12531254 if (!same_token_used) {
12541255 next_token_position = access_tokens_size;
12551256 access_tokens_size++;
12561257 #ifdef PDO_SQLSRV
1257- PDO_SQLSRV_G (access_tokens) = reinterpret_cast <ACCESSTOKEN**>(sqlsrv_realloc (PDO_SQLSRV_G (access_tokens), access_tokens_size * sizeof (ACCESSTOKEN)));
1258+ PDO_SQLSRV_G (access_tokens) = reinterpret_cast <ACCESSTOKEN**>(sqlsrv_realloc (PDO_SQLSRV_G (access_tokens), access_tokens_size * sizeof (ACCESSTOKEN* )));
12581259 #elif SQLSRV
1259- SQLSRV_G (access_tokens) = reinterpret_cast <ACCESSTOKEN**>(sqlsrv_realloc (SQLSRV_G (access_tokens), access_tokens_size * sizeof (ACCESSTOKEN)));
1260+ SQLSRV_G (access_tokens) = reinterpret_cast <ACCESSTOKEN**>(sqlsrv_realloc (SQLSRV_G (access_tokens), access_tokens_size * sizeof (ACCESSTOKEN* )));
12601261 #endif
12611262 }
12621263 get_access_tokens ()[next_token_position] = conn->azure_ad_access_token ;
0 commit comments