Skip to content

Commit f96df64

Browse files
committed
Fix VC compilation as variable size array is not supported
1 parent 04db3d0 commit f96df64

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ext/mysqlnd/mysqlnd_wireprotocol.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2277,7 +2277,12 @@ size_t php_mysqlnd_cached_sha2_result_write(void * _packet)
22772277
MYSQLND_PFC * pfc = packet->header.protocol_frame_codec;
22782278
MYSQLND_VIO * vio = packet->header.vio;
22792279
MYSQLND_STATS * stats = packet->header.stats;
2280+
#ifndef _MSC_VER
22802281
zend_uchar buffer[MYSQLND_HEADER_SIZE + packet->password_len + 1];
2282+
#else
2283+
ALLOCA_FLAG(use_heap)
2284+
zend_uchar *buffer = do_alloca(MYSQLND_HEADER_SIZE + packet->password_len + 1, use_heap);
2285+
#endif
22812286
size_t sent;
22822287

22832288
DBG_ENTER("php_mysqlnd_cached_sha2_result_write");
@@ -2290,6 +2295,10 @@ size_t php_mysqlnd_cached_sha2_result_write(void * _packet)
22902295
sent = pfc->data->m.send(pfc, vio, buffer, packet->password_len, stats, error_info);
22912296
}
22922297

2298+
#ifdef _MSC_VER
2299+
free_alloca(buffer, use_heap);
2300+
#endif
2301+
22932302
DBG_RETURN(sent);
22942303
}
22952304

0 commit comments

Comments
 (0)