Skip to content

Commit e857562

Browse files
committed
feat: output handler (PHP 8.0+)
1 parent c4fff56 commit e857562

3 files changed

Lines changed: 558 additions & 4 deletions

File tree

config.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ if test "$PHP_ZSTD" != "no"; then
8686
PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/zstd/lib/common)
8787
PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/zstd/lib)
8888
fi
89-
PHP_NEW_EXTENSION(zstd, zstd.c $ZSTD_COMMON_SOURCES $ZSTD_COMPRESS_SOURCES $ZSTD_DECOMPRESS_SOURCES, $ext_shared)
89+
PHP_NEW_EXTENSION(zstd, zstd.c $ZSTD_COMMON_SOURCES $ZSTD_COMPRESS_SOURCES $ZSTD_DECOMPRESS_SOURCES, $ext_shared,, [-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
9090
PHP_SUBST(ZSTD_SHARED_LIBADD)
9191

9292
if test "$PHP_LIBZSTD" = "no"; then

php_zstd.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,20 @@ extern zend_module_entry zstd_module_entry;
4242
#include "TSRM.h"
4343
#endif
4444

45+
#if PHP_VERSION_ID >= 80000
46+
typedef struct _php_zstd_context php_zstd_context;
47+
48+
ZEND_BEGIN_MODULE_GLOBALS(zstd)
49+
zend_long output_compression;
50+
zend_long output_compression_default;
51+
zend_long output_compression_level;
52+
char *output_compression_dict;
53+
php_zstd_context *ob_handler;
54+
bool handler_registered;
55+
int compression_coding;
56+
ZEND_END_MODULE_GLOBALS(zstd);
57+
#endif
58+
4559
#ifdef ZTS
4660
#define PHP_ZSTD_G(v) TSRMG(zstd_globals_id, zend_zstd_globals *, v)
4761
#else

0 commit comments

Comments
 (0)