Allow just set or get context passing NULL pointers

This commit is contained in:
Dmitry Stogov 2014-05-15 11:14:12 +04:00
parent 281663f75d
commit 04456f8fab

View File

@ -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) PHP_LIBXML_API void php_libxml_switch_context(zval *context, zval *oldcontext TSRMLS_DC)
{ {
ZVAL_COPY_VALUE(oldcontext, &LIBXML(stream_context)); if (oldcontext) {
ZVAL_COPY_VALUE(&LIBXML(stream_context), context); ZVAL_COPY_VALUE(oldcontext, &LIBXML(stream_context));
}
if (context) {
ZVAL_COPY_VALUE(&LIBXML(stream_context), context);
}
} }
static PHP_MINIT_FUNCTION(libxml) static PHP_MINIT_FUNCTION(libxml)