From: Dmitry Stogov Date: Thu, 15 May 2014 07:14:12 +0000 (+0400) Subject: Allow just set or get context passing NULL pointers X-Git-Tag: POST_PHPNG_MERGE~368^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=04456f8fab5749096b59bc017842887efc496829;p=php Allow just set or get context passing NULL pointers --- diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index 47bc5caae3..8fd661c81d 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -765,8 +765,12 @@ PHP_LIBXML_API void php_libxml_shutdown(void) PHP_LIBXML_API void php_libxml_switch_context(zval *context, zval *oldcontext TSRMLS_DC) { - ZVAL_COPY_VALUE(oldcontext, &LIBXML(stream_context)); - ZVAL_COPY_VALUE(&LIBXML(stream_context), context); + if (oldcontext) { + ZVAL_COPY_VALUE(oldcontext, &LIBXML(stream_context)); + } + if (context) { + ZVAL_COPY_VALUE(&LIBXML(stream_context), context); + } } static PHP_MINIT_FUNCTION(libxml)