Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions php_xz.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ extern php_stream_wrapper php_stream_xz_wrapper;
# include "TSRM.h"
#endif

#if PHP_VERSION_ID < 80600
# define zend_ini_long_literal(name) zend_ini_long((name), sizeof("" name) - 1, 0)
#endif

php_stream *php_stream_xzopen(php_stream_wrapper *wrapper, const char *path, const char *mode_pass, int options, zend_string **opened_path, php_stream_context *context STREAMS_DC);

#endif /* PHP_XZ_H */
Expand Down
6 changes: 3 additions & 3 deletions xz.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ PHP_FUNCTION(xzopen)
{
char *filename = NULL, *mode = NULL;
zend_long filename_len = 0, mode_len = 0;
zend_ulong compression_level = INI_INT("xz.compression_level");
zend_ulong compression_level = zend_ini_long_literal("xz.compression_level");

if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|l", &filename, &filename_len, &mode, &mode_len, &compression_level) == FAILURE) {
return;
Expand Down Expand Up @@ -127,7 +127,7 @@ PHP_FUNCTION(xzencode)
/* The length of the string to be encoded */
size_t in_len = 0;

zend_long compression_level = INI_INT("xz.compression_level");
zend_long compression_level = zend_ini_long_literal("xz.compression_level");

if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &in, &in_len, &compression_level) == FAILURE) {
return;
Expand Down Expand Up @@ -242,7 +242,7 @@ PHP_FUNCTION(xzdecode)

/* Initializing decoder. */
lzma_stream strm = LZMA_STREAM_INIT;
uint64_t mem = INI_INT("xz.max_memory");
uint64_t mem = zend_ini_long_literal("xz.max_memory");
if (lzma_auto_decoder(&strm, mem ? mem : UINT64_MAX, LZMA_CONCATENATED) != LZMA_OK) {
RETURN_BOOL(0);
}
Expand Down
4 changes: 2 additions & 2 deletions xz_fopen_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,8 @@ php_stream_ops php_stream_xzio_ops = {
php_stream *php_stream_xzopen(php_stream_wrapper *wrapper, const char *path, const char *mode_pass, int options, zend_string **opened_path, php_stream_context *context STREAMS_DC)
{
char mode[64];
zend_ulong level = INI_INT("xz.compression_level");;
zend_ulong mem = INI_INT("xz.max_memory");
zend_ulong level = zend_ini_long_literal("xz.compression_level");;
zend_ulong mem = zend_ini_long_literal("xz.max_memory");

php_stream *stream = NULL, *innerstream = NULL;

Expand Down