]> granicus.if.org Git - php/commitdiff
Kill a TSRMLS_FETCH() in php_stream_context_set() by passing TSRMLS_CC to it
authorKalle Sommer Nielsen <kalle@php.net>
Wed, 18 Dec 2013 08:19:24 +0000 (09:19 +0100)
committerKalle Sommer Nielsen <kalle@php.net>
Wed, 18 Dec 2013 08:19:24 +0000 (09:19 +0100)
# For mysqlnd: Relevant PHP_API_VERSION are put in place for cross version compatibility

ext/mysqlnd/mysqlnd_net.c
ext/standard/ftp_fopen_wrapper.c
ext/standard/http_fopen_wrapper.c
main/streams/php_stream_context.h
main/streams/streams.c
main/streams/transports.c

index fabceb4c8d661484b34f30614bb2205b3f85a604..cb6d0dc3a71862a6e52c4398f5973f448e58314e 100644 (file)
@@ -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;
index d04ef52be7494dabb6aca4eee1f04eecfae2595e..2c12857560ec558466048060626207e3f37f9f1f 100644 (file)
@@ -163,7 +163,7 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, const char
                goto connect_errexit;
        }
 
-       php_stream_context_set(stream, context);
+       php_stream_context_set(stream, context TSRMLS_CC);
        php_stream_notify_info(context, PHP_STREAM_NOTIFY_CONNECT, NULL, 0);
 
        /* Start talking to ftp server */
@@ -571,7 +571,7 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa
                goto errexit;   
        }
        
-       php_stream_context_set(datastream, context);
+       php_stream_context_set(datastream, context TSRMLS_CC);
        php_stream_notify_progress_init(context, 0, file_size);
 
        if (use_ssl_on_data && (php_stream_xport_crypto_setup(datastream,
@@ -745,7 +745,7 @@ php_stream * php_stream_ftp_opendir(php_stream_wrapper *wrapper, const char *pat
                goto opendir_errexit;   
        }
        
-       php_stream_context_set(datastream, context);
+       php_stream_context_set(datastream, context TSRMLS_CC);
 
        if (use_ssl_on_data && (php_stream_xport_crypto_setup(stream,
                        STREAM_CRYPTO_METHOD_SSLv23_CLIENT, NULL TSRMLS_CC) < 0 ||
index 9ac87cdca58dacfead5a86c1561023e8fde2e419..0a1ea1f467850e7343e2d43f44d7b547e2e1a486 100644 (file)
@@ -337,7 +337,7 @@ finish:
        eol_detect = stream->flags & (PHP_STREAM_FLAG_DETECT_EOL | PHP_STREAM_FLAG_EOL_MAC);
        stream->flags &= ~(PHP_STREAM_FLAG_DETECT_EOL | PHP_STREAM_FLAG_EOL_MAC);
 
-       php_stream_context_set(stream, context);
+       php_stream_context_set(stream, context TSRMLS_CC);
 
        php_stream_notify_info(context, PHP_STREAM_NOTIFY_CONNECT, NULL, 0);
 
index 59fa604306d1404be70c81105e9e0c9a954ed0a1..6c5c6894555859ff08e8f61bb08dc5f4ed16e3be 100644 (file)
@@ -87,7 +87,7 @@ END_EXTERN_C()
 BEGIN_EXTERN_C()
 PHPAPI void php_stream_notification_notify(php_stream_context *context, int notifycode, int severity,
                char *xmsg, int xcode, size_t bytes_sofar, size_t bytes_max, void * ptr TSRMLS_DC);
-PHPAPI php_stream_context *php_stream_context_set(php_stream *stream, php_stream_context *context);
+PHPAPI php_stream_context *php_stream_context_set(php_stream *stream, php_stream_context *context TSRMLS_DC);
 END_EXTERN_C()
 
 #define php_stream_notify_info(context, code, xmsg, xcode)     do { if ((context) && (context)->notifier) { \
index d74f9fd04aa7554052de3b59407ebbd489500141..8e954c1c0f22e012932bb053f12f24a13e0c3758 100644 (file)
@@ -2148,10 +2148,9 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mod
 /* }}} */
 
 /* {{{ context API */
-PHPAPI php_stream_context *php_stream_context_set(php_stream *stream, php_stream_context *context)
+PHPAPI php_stream_context *php_stream_context_set(php_stream *stream, php_stream_context *context TSRMLS_DC)
 {
        php_stream_context *oldcontext = stream->context;
-       TSRMLS_FETCH();
 
        stream->context = context;
 
index 2d31074ded8076c41dc2e7a1a04944d51ab3e54d..1f87ab3c6c4802a868b4ec72f1e1a085e7dd45bd 100644 (file)
@@ -134,7 +134,7 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, in
                        context STREAMS_REL_CC TSRMLS_CC);
 
        if (stream) {
-               php_stream_context_set(stream, context);
+               php_stream_context_set(stream, context TSRMLS_CC);
 
                if ((flags & STREAM_XPORT_SERVER) == 0) {
                        /* client */