diff --git a/tests/ob_dcz_005.phpt b/tests/ob_dcz_005.phpt new file mode 100644 index 0000000..f942e7d --- /dev/null +++ b/tests/ob_dcz_005.phpt @@ -0,0 +1,24 @@ +--TEST-- +output handler: dcz +--SKIPIF-- + +--GET-- +ob=dictionary +--ENV-- +HTTP_ACCEPT_ENCODING=zstd,dcz +HTTP_AVAILABLE_DICTIONARY=:5wg7BLZeirApJAxOdI/QBi8RvwZuIJfPf0TwMo/x/yg=: +--FILE-- + +--EXPECT_EXTERNAL-- +files/ob_data.zstd +--EXPECTHEADERS-- +Content-Encoding: zstd +Vary: Accept-Encoding diff --git a/zstd.c b/zstd.c index 6623573..3e498c9 100644 --- a/zstd.c +++ b/zstd.c @@ -1298,6 +1298,7 @@ php_zstd_output_handler_load_dict(php_zstd_context *ctx) char *dict = PHP_ZSTD_G(output_compression_dict); if (!dict || strlen(dict) <= 0) { + PHP_ZSTD_G(compression_coding) &= ~PHP_ZSTD_ENCODING_DCZ; return NULL; } @@ -1307,6 +1308,7 @@ php_zstd_output_handler_load_dict(php_zstd_context *ctx) NULL, context); if (!stream) { ZSTD_WARNING("could not open dictionary stream: %s", dict); + PHP_ZSTD_G(compression_coding) &= ~PHP_ZSTD_ENCODING_DCZ; return NULL; } @@ -1320,6 +1322,7 @@ php_zstd_output_handler_load_dict(php_zstd_context *ctx) php_stream_close(stream); if (!data) { + PHP_ZSTD_G(compression_coding) &= ~PHP_ZSTD_ENCODING_DCZ; return NULL; }