From fe0763c81f10c22951bd24aeb2ff001c5693d1b5 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 6 Oct 2020 13:07:21 +0200 Subject: [PATCH] Make $use_less_memory a boolean parameter --- ext/bz2/bz2.c | 4 ++-- ext/bz2/bz2.stub.php | 2 +- ext/bz2/bz2_arginfo.h | 4 ++-- ext/bz2/tests/005.phpt | 9 +++++---- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ext/bz2/bz2.c b/ext/bz2/bz2.c index 9a8d956e4f..d83853aef9 100644 --- a/ext/bz2/bz2.c +++ b/ext/bz2/bz2.c @@ -496,7 +496,7 @@ PHP_FUNCTION(bzdecompress) zend_string *dest; size_t source_len; int error; - zend_long small = 0; + zend_bool small = 0; #ifdef PHP_WIN32 unsigned __int64 size = 0; #else @@ -504,7 +504,7 @@ PHP_FUNCTION(bzdecompress) #endif bz_stream bzs; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &source, &source_len, &small)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|b", &source, &source_len, &small)) { RETURN_THROWS(); } diff --git a/ext/bz2/bz2.stub.php b/ext/bz2/bz2.stub.php index 783f9170fc..279f96d496 100644 --- a/ext/bz2/bz2.stub.php +++ b/ext/bz2/bz2.stub.php @@ -40,4 +40,4 @@ function bzerror($bz): array {} function bzcompress(string $data, int $block_size = 4, int $work_factor = 0): string|int {} -function bzdecompress(string $data, int $use_less_memory = 0): string|int|false {} +function bzdecompress(string $data, bool $use_less_memory = false): string|int|false {} diff --git a/ext/bz2/bz2_arginfo.h b/ext/bz2/bz2_arginfo.h index 2d9f2da105..25e674df18 100644 --- a/ext/bz2/bz2_arginfo.h +++ b/ext/bz2/bz2_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 305cbe9825a0d62ad966c09a50c53dd6cc49011e */ + * Stub hash: 6953f91be31777e4d4e3652f75eec6d968cf636a */ ZEND_BEGIN_ARG_INFO_EX(arginfo_bzopen, 0, 0, 2) ZEND_ARG_INFO(0, file) @@ -43,7 +43,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_bzdecompress, 0, 1, MAY_BE_STRING|MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, use_less_memory, IS_LONG, 0, "0") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, use_less_memory, _IS_BOOL, 0, "false") ZEND_END_ARG_INFO() diff --git a/ext/bz2/tests/005.phpt b/ext/bz2/tests/005.phpt index ff14e65659..5fc7ef0b7c 100644 --- a/ext/bz2/tests/005.phpt +++ b/ext/bz2/tests/005.phpt @@ -26,9 +26,8 @@ var_dump(bzdecompress(1,1)); var_dump(bzdecompress($data3)); var_dump(bzdecompress($data3,1)); -var_dump(bzdecompress($data, -1)); var_dump(bzdecompress($data, 0)); -var_dump(bzdecompress($data, 1000)); +var_dump(bzdecompress($data, 1)); var_dump(bzdecompress($data)); var_dump(bzdecompress($data2)); @@ -43,12 +42,14 @@ int(-2) int(-5) int(-5) int(-5) -bool(false) string(110) "Life it seems, will fade away Drifting further everyday Getting lost within myself Nothing matters no one else" -bool(false) +string(110) "Life it seems, will fade away +Drifting further everyday +Getting lost within myself +Nothing matters no one else" string(110) "Life it seems, will fade away Drifting further everyday Getting lost within myself -- 2.40.0