From 9f5508bfa70b8774403e115a0e5cee789205617d Mon Sep 17 00:00:00 2001 From: Andy Postnikov Date: Wed, 9 Dec 2020 01:28:56 +0200 Subject: [PATCH 1/2] Fix ZEND_TYPE_ENCODE_CLASS_CONST to ZEND_TYPE_INIT_CLASS_CONST --- src/arginfo.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/arginfo.h b/src/arginfo.h index 754397a..e4da37a 100644 --- a/src/arginfo.h +++ b/src/arginfo.h @@ -42,7 +42,7 @@ #if PHP_VERSION_ID >= 70200 #define PHP_DECIMAL_ARGINFO_RETURN_NUMBER(cls, name, required_num_args) \ static const zend_internal_arg_info PHP_DECIMAL_ARGINFO_NAME(cls, name)[] = { \ - {(const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_ENCODE_CLASS_CONST(PHP_DECIMAL_NUMBER_FQCN, 0), 0, 0}, + {(const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_INIT_CLASS_CONST(PHP_DECIMAL_NUMBER_FQCN, 0, 0), 0}, #else #define PHP_DECIMAL_ARGINFO_RETURN_NUMBER(cls, name, required_num_args) \ static const zend_internal_arg_info PHP_DECIMAL_ARGINFO_NAME(cls, name)[] = { \ @@ -52,7 +52,7 @@ #if PHP_VERSION_ID >= 70200 #define PHP_DECIMAL_ARGINFO_RETURN_DECIMAL(cls, name, required_num_args) \ const zend_internal_arg_info PHP_DECIMAL_ARGINFO_NAME(cls, name)[] = { \ - {(const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_ENCODE_CLASS_CONST(PHP_DECIMAL_DECIMAL_FQCN, 0), 0, 0}, + {(const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_INIT_CLASS_CONST(PHP_DECIMAL_DECIMAL_FQCN, 0, 0), 0}, #else #define PHP_DECIMAL_ARGINFO_RETURN_DECIMAL(cls, name, required_num_args) \ const zend_internal_arg_info PHP_DECIMAL_ARGINFO_NAME(cls, name)[] = { \ @@ -62,7 +62,7 @@ #if PHP_VERSION_ID >= 70200 #define PHP_DECIMAL_ARGINFO_RETURN_RATIONAL(cls, name, required_num_args) \ const zend_internal_arg_info PHP_DECIMAL_ARGINFO_NAME(cls, name)[] = { \ - {(const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_ENCODE_CLASS_CONST(PHP_DECIMAL_RATIONAL_FQCN, 0), 0, 0}, + {(const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_INIT_CLASS_CONST(PHP_DECIMAL_RATIONAL_FQCN, 0, 0), 0}, #else #define PHP_DECIMAL_ARGINFO_RETURN_RATIONAL(cls, name, required_num_args) \ const zend_internal_arg_info PHP_DECIMAL_ARGINFO_NAME(cls, name)[] = { \ @@ -73,7 +73,7 @@ #if PHP_VERSION_ID >= 70200 #define PHP_DECIMAL_ARGINFO_RETURN_NUMBER(cls, name, required_num_args) \ static const zend_internal_arg_info PHP_DECIMAL_ARGINFO_NAME(cls, name)[] = { \ - {(const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_ENCODE_CLASS_CONST(PHP_DECIMAL_RATIONAL_FQCN, 0), 0, 0}, + {(const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_INIT_CLASS_CONST(PHP_DECIMAL_RATIONAL_FQCN, 0, 0), 0}, #else #define PHP_DECIMAL_ARGINFO_RETURN_NUMBER(cls, name, required_num_args) \ static const zend_internal_arg_info PHP_DECIMAL_ARGINFO_NAME(cls, name)[] = { \ From 87b21e706f8f1cb870b564c177e621b4098fa5a6 Mon Sep 17 00:00:00 2001 From: Andy Postnikov Date: Wed, 9 Dec 2020 01:35:16 +0200 Subject: [PATCH 2/2] Fix Z_PARAM_STRICT_LONG to Z_PARAM_LONG --- src/decimal.c | 12 ++++++------ src/number.c | 2 +- src/rational.c | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/decimal.c b/src/decimal.c index a5bab69..4b222ce 100644 --- a/src/decimal.c +++ b/src/decimal.c @@ -510,7 +510,7 @@ PHP_DECIMAL_METHOD(Decimal, valueOf) PHP_DECIMAL_PARSE_PARAMS(1, 2) Z_PARAM_ZVAL(val) Z_PARAM_OPTIONAL - Z_PARAM_STRICT_LONG(prec) + Z_PARAM_LONG(prec) PHP_DECIMAL_PARSE_PARAMS_END() if (ZEND_NUM_ARGS() == 1) { @@ -663,8 +663,8 @@ PHP_DECIMAL_METHOD(Decimal, round) PHP_DECIMAL_PARSE_PARAMS(0, 2) Z_PARAM_OPTIONAL - Z_PARAM_STRICT_LONG(places) - Z_PARAM_STRICT_LONG(mode) + Z_PARAM_LONG(places) + Z_PARAM_LONG(mode) PHP_DECIMAL_PARSE_PARAMS_END() { php_decimal_t *obj = THIS_DECIMAL(); @@ -912,9 +912,9 @@ PHP_DECIMAL_METHOD(Decimal, toFixed) PHP_DECIMAL_PARSE_PARAMS(0, 3) Z_PARAM_OPTIONAL - Z_PARAM_STRICT_LONG(places) + Z_PARAM_LONG(places) Z_PARAM_BOOL(commas) - Z_PARAM_STRICT_LONG(mode) + Z_PARAM_LONG(mode) PHP_DECIMAL_PARSE_PARAMS_END() RETURN_STR(php_decimal_mpd_to_fixed(THIS_DECIMAL_MPD(), places, commas, mode)); @@ -978,7 +978,7 @@ PHP_DECIMAL_METHOD(Decimal, toDecimal) zend_long prec; PHP_DECIMAL_PARSE_PARAMS(1, 1) - Z_PARAM_STRICT_LONG(prec) + Z_PARAM_LONG(prec) PHP_DECIMAL_PARSE_PARAMS_END() if (php_decimal_validate_prec(prec)) { diff --git a/src/number.c b/src/number.c index 2970b93..3dc6150 100644 --- a/src/number.c +++ b/src/number.c @@ -503,7 +503,7 @@ PHP_DECIMAL_METHOD(Number, toDecimal) zend_long prec; PHP_DECIMAL_PARSE_PARAMS(1, 1) - Z_PARAM_STRICT_LONG(prec) + Z_PARAM_LONG(prec) PHP_DECIMAL_PARSE_PARAMS_END() { if (EXPECTED(php_decimal_validate_prec(prec))) { diff --git a/src/rational.c b/src/rational.c index 1038135..c8ebc95 100644 --- a/src/rational.c +++ b/src/rational.c @@ -674,8 +674,8 @@ PHP_DECIMAL_METHOD(Rational, round) PHP_DECIMAL_PARSE_PARAMS(0, 2) Z_PARAM_OPTIONAL - Z_PARAM_STRICT_LONG(places) - Z_PARAM_STRICT_LONG(mode) + Z_PARAM_LONG(places) + Z_PARAM_LONG(mode) PHP_DECIMAL_PARSE_PARAMS_END() { php_rational_t *res = php_rational(); @@ -846,9 +846,9 @@ PHP_DECIMAL_METHOD(Rational, toFixed) PHP_DECIMAL_PARSE_PARAMS(0, 3) Z_PARAM_OPTIONAL - Z_PARAM_STRICT_LONG(places) + Z_PARAM_LONG(places) Z_PARAM_BOOL(commas) - Z_PARAM_STRICT_LONG(mode) + Z_PARAM_LONG(mode) PHP_DECIMAL_PARSE_PARAMS_END() RETURN_STR(php_decimal_rational_to_fixed(THIS_RATIONAL(), places, commas, mode)); @@ -866,7 +866,7 @@ PHP_DECIMAL_METHOD(Rational, toSci) PHP_DECIMAL_PARSE_PARAMS(0, 1) Z_PARAM_OPTIONAL - Z_PARAM_STRICT_LONG(prec) + Z_PARAM_LONG(prec) PHP_DECIMAL_PARSE_PARAMS_END() RETURN_STR(php_decimal_rational_to_sci(THIS_RATIONAL(), prec)); @@ -918,7 +918,7 @@ PHP_DECIMAL_METHOD(Rational, toDecimal) zend_long prec; PHP_DECIMAL_PARSE_PARAMS(1, 1) - Z_PARAM_STRICT_LONG(prec) + Z_PARAM_LONG(prec) PHP_DECIMAL_PARSE_PARAMS_END() if (php_decimal_validate_prec(prec)) {