diff --git a/Zend/zend_observer.c b/Zend/zend_observer.c index f5f90c3c1f13..1cb4373f4c07 100644 --- a/Zend/zend_observer.c +++ b/Zend/zend_observer.c @@ -167,7 +167,7 @@ static bool zend_observer_remove_handler(void **first_handler, const void *old_h *next_handler = NULL; } else { if (cur_handler != last_handler) { - memmove(cur_handler, cur_handler + 1, sizeof(cur_handler) * (last_handler - cur_handler)); + memmove(cur_handler, cur_handler + 1, sizeof(*cur_handler) * (last_handler - cur_handler)); } *last_handler = NULL; *next_handler = *cur_handler; @@ -218,7 +218,7 @@ ZEND_API void zend_observer_add_end_handler(const zend_function *function, zend_ if (*end_handler != ZEND_OBSERVER_NOT_OBSERVED) { // there's no space for new handlers, then it's forbidden to call this function ZEND_ASSERT(end_handler[registered_observers - 1] == NULL); - memmove(end_handler + 1, end_handler, sizeof(end_handler) * (registered_observers - 1)); + memmove(end_handler + 1, end_handler, sizeof(*end_handler) * (registered_observers - 1)); } else if (*begin_handler == ZEND_OBSERVER_NONE_OBSERVED) { *begin_handler = ZEND_OBSERVER_NOT_OBSERVED; } diff --git a/ext/intl/spoofchecker/spoofchecker.stub.php b/ext/intl/spoofchecker/spoofchecker.stub.php index 0141252d478d..51a9c7d39074 100644 --- a/ext/intl/spoofchecker/spoofchecker.stub.php +++ b/ext/intl/spoofchecker/spoofchecker.stub.php @@ -19,7 +19,6 @@ class Spoofchecker public const int INVISIBLE = UNKNOWN; /** @cvalue USPOOF_CHAR_LIMIT */ public const int CHAR_LIMIT = UNKNOWN; -#if U_ICU_VERSION_MAJOR_NUM >= 58 /** @cvalue USPOOF_ASCII */ public const int ASCII = UNKNOWN; /** @cvalue USPOOF_HIGHLY_RESTRICTIVE */ @@ -34,7 +33,6 @@ class Spoofchecker public const int SINGLE_SCRIPT_RESTRICTIVE = UNKNOWN; /** @cvalue USPOOF_MIXED_NUMBERS */ public const int MIXED_NUMBERS = UNKNOWN; -#endif #if U_ICU_VERSION_MAJOR_NUM >= 62 /** @cvalue USPOOF_HIDDEN_OVERLAY */ public const int HIDDEN_OVERLAY = UNKNOWN; @@ -71,9 +69,7 @@ public function setAllowedLocales(string $locales): void {} /** @tentative-return-type */ public function setChecks(int $checks): void {} -#if U_ICU_VERSION_MAJOR_NUM >= 58 /** @tentative-return-type */ public function setRestrictionLevel(int $level): void {} -#endif public function setAllowedChars(string $pattern, int $patternOptions = 0): void {} } diff --git a/ext/intl/spoofchecker/spoofchecker_arginfo.h b/ext/intl/spoofchecker/spoofchecker_arginfo.h index 536798914428..8704065e479b 100644 --- a/ext/intl/spoofchecker/spoofchecker_arginfo.h +++ b/ext/intl/spoofchecker/spoofchecker_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit spoofchecker.stub.php instead. - * Stub hash: 4834be57a3f0cb74dbc4422e609846139f09f6cb */ + * Stub hash: 4634f8ef9157fb3670a2ddc5e3246340660fc68c */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Spoofchecker___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -23,11 +23,9 @@ ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_Spoofchecker_set ZEND_ARG_TYPE_INFO(0, checks, IS_LONG, 0) ZEND_END_ARG_INFO() -#if U_ICU_VERSION_MAJOR_NUM >= 58 ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_Spoofchecker_setRestrictionLevel, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, level, IS_LONG, 0) ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Spoofchecker_setAllowedChars, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0) @@ -39,9 +37,7 @@ ZEND_METHOD(Spoofchecker, isSuspicious); ZEND_METHOD(Spoofchecker, areConfusable); ZEND_METHOD(Spoofchecker, setAllowedLocales); ZEND_METHOD(Spoofchecker, setChecks); -#if U_ICU_VERSION_MAJOR_NUM >= 58 ZEND_METHOD(Spoofchecker, setRestrictionLevel); -#endif ZEND_METHOD(Spoofchecker, setAllowedChars); static const zend_function_entry class_Spoofchecker_methods[] = { @@ -50,9 +46,7 @@ static const zend_function_entry class_Spoofchecker_methods[] = { ZEND_ME(Spoofchecker, areConfusable, arginfo_class_Spoofchecker_areConfusable, ZEND_ACC_PUBLIC) ZEND_ME(Spoofchecker, setAllowedLocales, arginfo_class_Spoofchecker_setAllowedLocales, ZEND_ACC_PUBLIC) ZEND_ME(Spoofchecker, setChecks, arginfo_class_Spoofchecker_setChecks, ZEND_ACC_PUBLIC) -#if U_ICU_VERSION_MAJOR_NUM >= 58 ZEND_ME(Spoofchecker, setRestrictionLevel, arginfo_class_Spoofchecker_setRestrictionLevel, ZEND_ACC_PUBLIC) -#endif ZEND_ME(Spoofchecker, setAllowedChars, arginfo_class_Spoofchecker_setAllowedChars, ZEND_ACC_PUBLIC) ZEND_FE_END }; @@ -105,7 +99,6 @@ static zend_class_entry *register_class_Spoofchecker(void) zend_string *const_CHAR_LIMIT_name = zend_string_init_interned("CHAR_LIMIT", sizeof("CHAR_LIMIT") - 1, true); zend_declare_typed_class_constant(class_entry, const_CHAR_LIMIT_name, &const_CHAR_LIMIT_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG)); zend_string_release_ex(const_CHAR_LIMIT_name, true); -#if U_ICU_VERSION_MAJOR_NUM >= 58 zval const_ASCII_value; ZVAL_LONG(&const_ASCII_value, USPOOF_ASCII); @@ -148,7 +141,6 @@ static zend_class_entry *register_class_Spoofchecker(void) zend_string *const_MIXED_NUMBERS_name = zend_string_init_interned("MIXED_NUMBERS", sizeof("MIXED_NUMBERS") - 1, true); zend_declare_typed_class_constant(class_entry, const_MIXED_NUMBERS_name, &const_MIXED_NUMBERS_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG)); zend_string_release_ex(const_MIXED_NUMBERS_name, true); -#endif #if U_ICU_VERSION_MAJOR_NUM >= 62 zval const_HIDDEN_OVERLAY_value; diff --git a/ext/intl/spoofchecker/spoofchecker_main.cpp b/ext/intl/spoofchecker/spoofchecker_main.cpp index e3e21ef72b79..73e14cabeaf1 100644 --- a/ext/intl/spoofchecker/spoofchecker_main.cpp +++ b/ext/intl/spoofchecker/spoofchecker_main.cpp @@ -142,7 +142,7 @@ U_CFUNC PHP_METHOD(Spoofchecker, setChecks) } /* }}} */ -#if U_ICU_VERSION_MAJOR_NUM >= 58 +/* TODO Document this method on PHP.net */ /* {{{ Set the loosest restriction level allowed for strings. */ U_CFUNC PHP_METHOD(Spoofchecker, setRestrictionLevel) { @@ -170,7 +170,6 @@ U_CFUNC PHP_METHOD(Spoofchecker, setRestrictionLevel) uspoof_setRestrictionLevel(co->uspoof, (URestrictionLevel)level); } /* }}} */ -#endif U_CFUNC PHP_METHOD(Spoofchecker, setAllowedChars) { @@ -214,9 +213,9 @@ U_CFUNC PHP_METHOD(Spoofchecker, setAllowedChars) #endif pattern_option != (USET_IGNORE_SPACE|USET_CASE_INSENSITIVE) && pattern_option != (USET_IGNORE_SPACE|USET_ADD_CASE_MAPPINGS)) { - zend_argument_value_error(2, "must be a valid pattern option, 0 or (SpoofChecker::IGNORE_SPACE|( or SpoofChecker::USET_CASE_INSENSITIVE or SpoofChecker::USET_ADD_CASE_MAPPINGS" + zend_argument_value_error(2, "must be a valid pattern option, 0 or (SpoofChecker::IGNORE_SPACE|( or SpoofChecker::CASE_INSENSITIVE or SpoofChecker::ADD_CASE_MAPPINGS" #if U_ICU_VERSION_MAJOR_NUM >= 73 - " or SpoofChecker::USET_SIMPLE_CASE_INSENSITIVE" + " or SpoofChecker::SIMPLE_CASE_INSENSITIVE" #endif "))" ); diff --git a/ext/intl/tests/spoofchecker_007.phpt b/ext/intl/tests/spoofchecker_007.phpt index b5fc5814ddf8..5f3dbb47f192 100644 --- a/ext/intl/tests/spoofchecker_007.phpt +++ b/ext/intl/tests/spoofchecker_007.phpt @@ -4,12 +4,6 @@ spoofchecker with restriction level intl --SKIPIF-- -getConstant("SINGLE_SCRIPT_RESTRICTIVE")) { - die("skip Incompatible ICU version"); - } -?> --FILE-- or SpoofChecker::USET_CASE_INSENSITIVE%s)) +Spoofchecker::setAllowedChars(): Argument #2 ($patternOptions) must be a valid pattern option, 0 or (SpoofChecker::IGNORE_SPACE|( or SpoofChecker::CASE_INSENSITIVE%s)) Spoofchecker::setAllowedChars(): Argument #1 ($pattern) must be a valid regular expression character set pattern Spoofchecker::setAllowedChars(): Argument #1 ($pattern) must be a valid regular expression character set pattern diff --git a/ext/intl/tests/spoofchecker_supported_icu57_apis.phpt b/ext/intl/tests/spoofchecker_supported_icu57_apis.phpt new file mode 100644 index 000000000000..56cc194991ee --- /dev/null +++ b/ext/intl/tests/spoofchecker_supported_icu57_apis.phpt @@ -0,0 +1,36 @@ +--TEST-- +Spoofchecker exposes restriction-level APIs on all supported ICU versions +--EXTENSIONS-- +intl +--SKIPIF-- + +--FILE-- +getConstant("ASCII"); +$singleScriptRestrictive = $r->getConstant("SINGLE_SCRIPT_RESTRICTIVE"); +$mixedNumbers = $r->getConstant("MIXED_NUMBERS"); + +var_dump($ascii !== false); +var_dump($singleScriptRestrictive !== false); +var_dump($mixedNumbers !== false); +var_dump(is_int($ascii)); +var_dump(is_int($singleScriptRestrictive)); +var_dump(is_int($mixedNumbers)); +var_dump($ascii !== $singleScriptRestrictive); +var_dump($ascii !== $mixedNumbers); +var_dump($singleScriptRestrictive !== $mixedNumbers); +var_dump($r->hasMethod("setRestrictionLevel")); +?> +--EXPECT-- +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) diff --git a/ext/intl/tests/spoofchecker_unknown_restriction_level.phpt b/ext/intl/tests/spoofchecker_unknown_restriction_level.phpt index 6b7e9474755d..187be350f594 100644 --- a/ext/intl/tests/spoofchecker_unknown_restriction_level.phpt +++ b/ext/intl/tests/spoofchecker_unknown_restriction_level.phpt @@ -5,8 +5,6 @@ intl --SKIPIF-- --FILE--