From f96df64cb2219fda42ca875483f874cf3052647c Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Wed, 6 Jun 2018 11:13:28 +0200 Subject: Fix VC compilation as variable size array is not supported --- ext/mysqlnd/mysqlnd_wireprotocol.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'ext/mysqlnd/mysqlnd_wireprotocol.c') diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c index e782d990c1..c5039c3d72 100644 --- a/ext/mysqlnd/mysqlnd_wireprotocol.c +++ b/ext/mysqlnd/mysqlnd_wireprotocol.c @@ -2277,7 +2277,12 @@ size_t php_mysqlnd_cached_sha2_result_write(void * _packet) MYSQLND_PFC * pfc = packet->header.protocol_frame_codec; MYSQLND_VIO * vio = packet->header.vio; MYSQLND_STATS * stats = packet->header.stats; +#ifndef _MSC_VER zend_uchar buffer[MYSQLND_HEADER_SIZE + packet->password_len + 1]; +#else + ALLOCA_FLAG(use_heap) + zend_uchar *buffer = do_alloca(MYSQLND_HEADER_SIZE + packet->password_len + 1, use_heap); +#endif size_t sent; DBG_ENTER("php_mysqlnd_cached_sha2_result_write"); @@ -2290,6 +2295,10 @@ size_t php_mysqlnd_cached_sha2_result_write(void * _packet) sent = pfc->data->m.send(pfc, vio, buffer, packet->password_len, stats, error_info); } +#ifdef _MSC_VER + free_alloca(buffer, use_heap); +#endif + DBG_RETURN(sent); } -- cgit v1.2.1