From c83598119be083b572e92af292e9e9faa98d8d85 Mon Sep 17 00:00:00 2001 From: Kalle Sommer Nielsen Date: Wed, 18 Dec 2013 09:19:24 +0100 Subject: Kill a TSRMLS_FETCH() in php_stream_context_set() by passing TSRMLS_CC to it # For mysqlnd: Relevant PHP_API_VERSION are put in place for cross version compatibility --- ext/mysqlnd/mysqlnd_net.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ext/mysqlnd/mysqlnd_net.c') diff --git a/ext/mysqlnd/mysqlnd_net.c b/ext/mysqlnd/mysqlnd_net.c index fabceb4c8d..cb6d0dc3a7 100644 --- a/ext/mysqlnd/mysqlnd_net.c +++ b/ext/mysqlnd/mysqlnd_net.c @@ -900,7 +900,11 @@ MYSQLND_METHOD(mysqlnd_net, enable_ssl)(MYSQLND_NET * const net TSRMLS_DC) ZVAL_STRING(&cipher_zval, net->data->options.ssl_cipher, 0); php_stream_context_set_option(context, "ssl", "ciphers", &cipher_zval); } +#if PHP_API_VERSION >= 20131106 + php_stream_context_set(net_stream, context TSRMLS_CC); +#else php_stream_context_set(net_stream, context); +#endif if (php_stream_xport_crypto_setup(net_stream, STREAM_CRYPTO_METHOD_TLS_CLIENT, NULL TSRMLS_CC) < 0 || php_stream_xport_crypto_enable(net_stream, 1 TSRMLS_CC) < 0) { @@ -916,7 +920,11 @@ MYSQLND_METHOD(mysqlnd_net, enable_ssl)(MYSQLND_NET * const net TSRMLS_DC) of the context, which means usage of already freed memory, bad. Actually we don't need this context anymore after we have enabled SSL on the connection. Thus it is very simple, we remove it. */ +#if PHP_API_VERSION >= 20131106 + php_stream_context_set(net_stream, NULL TSRMLS_CC); +#else php_stream_context_set(net_stream, NULL); +#endif if (net->data->options.timeout_read) { struct timeval tv; -- cgit v1.2.1