diff options
author | Anatol Belski <ab@php.net> | 2017-10-30 19:48:21 +0100 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2017-10-30 19:52:27 +0100 |
commit | 0fe6724fce994dca930127df6b548aaffce037ee (patch) | |
tree | acb77ae1b032837aec90e84746fc5659013b0d3c | |
parent | 2b43c623b97de06890def8d421e9c5c37ccad000 (diff) | |
download | php-git-0fe6724fce994dca930127df6b548aaffce037ee.tar.gz |
Rethink the version checks
As the actual behavior change happens with ICU >= 58, the new
functionality should stay same in the lower versions. This comply also
with lower PHP versions so far.
-rw-r--r-- | ext/intl/spoofchecker/spoofchecker.c | 4 | ||||
-rw-r--r-- | ext/intl/spoofchecker/spoofchecker_class.c | 4 | ||||
-rw-r--r-- | ext/intl/spoofchecker/spoofchecker_class.h | 2 | ||||
-rw-r--r-- | ext/intl/spoofchecker/spoofchecker_create.c | 2 | ||||
-rw-r--r-- | ext/intl/spoofchecker/spoofchecker_main.c | 4 | ||||
-rw-r--r-- | ext/intl/spoofchecker/spoofchecker_main.h | 2 |
6 files changed, 7 insertions, 11 deletions
diff --git a/ext/intl/spoofchecker/spoofchecker.c b/ext/intl/spoofchecker/spoofchecker.c index 2db28612d4..221b69ee5b 100644 --- a/ext/intl/spoofchecker/spoofchecker.c +++ b/ext/intl/spoofchecker/spoofchecker.c @@ -45,14 +45,12 @@ void spoofchecker_register_constants(INIT_FUNC_ARGS) SPOOFCHECKER_EXPOSE_CLASS_CONST(INVISIBLE) SPOOFCHECKER_EXPOSE_CLASS_CONST(CHAR_LIMIT) -#if U_ICU_VERSION_MAJOR_NUM >= 51 +#if U_ICU_VERSION_MAJOR_NUM >= 58 SPOOFCHECKER_EXPOSE_CLASS_CONST(ASCII) SPOOFCHECKER_EXPOSE_CLASS_CONST(HIGHLY_RESTRICTIVE) SPOOFCHECKER_EXPOSE_CLASS_CONST(MODERATELY_RESTRICTIVE) SPOOFCHECKER_EXPOSE_CLASS_CONST(MINIMALLY_RESTRICTIVE) SPOOFCHECKER_EXPOSE_CLASS_CONST(UNRESTRICTIVE) -#endif -#if U_ICU_VERSION_MAJOR_NUM >= 53 SPOOFCHECKER_EXPOSE_CLASS_CONST(SINGLE_SCRIPT_RESTRICTIVE) #endif diff --git a/ext/intl/spoofchecker/spoofchecker_class.c b/ext/intl/spoofchecker/spoofchecker_class.c index 36545beb49..ab41a00490 100644 --- a/ext/intl/spoofchecker/spoofchecker_class.c +++ b/ext/intl/spoofchecker/spoofchecker_class.c @@ -84,7 +84,7 @@ ZEND_BEGIN_ARG_INFO_EX(spoofchecker_are_confusable, 0, 0, 2) ZEND_ARG_INFO(1, error) ZEND_END_ARG_INFO() -#if U_ICU_VERSION_MAJOR_NUM >= 51 +#if U_ICU_VERSION_MAJOR_NUM >= 58 ZEND_BEGIN_ARG_INFO_EX(spoofchecker_set_restriction_level, 0, 0, 1) ZEND_ARG_INFO(0, level) ZEND_END_ARG_INFO() @@ -102,7 +102,7 @@ zend_function_entry Spoofchecker_class_functions[] = { PHP_ME(Spoofchecker, areConfusable, spoofchecker_are_confusable, ZEND_ACC_PUBLIC) PHP_ME(Spoofchecker, setAllowedLocales, spoofchecker_set_allowed_locales, ZEND_ACC_PUBLIC) PHP_ME(Spoofchecker, setChecks, spoofchecker_set_checks, ZEND_ACC_PUBLIC) -#if U_ICU_VERSION_MAJOR_NUM >= 51 +#if U_ICU_VERSION_MAJOR_NUM >= 58 PHP_ME(Spoofchecker, setRestrictionLevel, spoofchecker_set_restriction_level, ZEND_ACC_PUBLIC) #endif PHP_FE_END diff --git a/ext/intl/spoofchecker/spoofchecker_class.h b/ext/intl/spoofchecker/spoofchecker_class.h index 108bc4a11d..c0cb0c5327 100644 --- a/ext/intl/spoofchecker/spoofchecker_class.h +++ b/ext/intl/spoofchecker/spoofchecker_class.h @@ -78,7 +78,7 @@ extern zend_class_entry *Spoofchecker_ce_ptr; RETURN_FALSE; \ } \ -#if U_ICU_VERSION_MAJOR_NUM >= 51 +#if U_ICU_VERSION_MAJOR_NUM >= 58 #define SPOOFCHECKER_DEFAULT_RESTRICTION_LEVEL USPOOF_HIGHLY_RESTRICTIVE #endif diff --git a/ext/intl/spoofchecker/spoofchecker_create.c b/ext/intl/spoofchecker/spoofchecker_create.c index eb969155c9..8108cafa2f 100644 --- a/ext/intl/spoofchecker/spoofchecker_create.c +++ b/ext/intl/spoofchecker/spoofchecker_create.c @@ -43,7 +43,7 @@ PHP_METHOD(Spoofchecker, __construct) co->uspoof = uspoof_open(SPOOFCHECKER_ERROR_CODE_P(co)); INTL_METHOD_CHECK_STATUS(co, "spoofchecker: unable to open ICU Spoof Checker"); -#if U_ICU_VERSION_MAJOR_NUM >= 51 +#if U_ICU_VERSION_MAJOR_NUM >= 58 /* TODO save it into the object for further suspiction check comparison. */ /* ICU 58 removes WSC and MSC handling. However there are restriction levels as defined in diff --git a/ext/intl/spoofchecker/spoofchecker_main.c b/ext/intl/spoofchecker/spoofchecker_main.c index d981c9fe10..d41a9ae9cc 100644 --- a/ext/intl/spoofchecker/spoofchecker_main.c +++ b/ext/intl/spoofchecker/spoofchecker_main.c @@ -134,7 +134,7 @@ PHP_METHOD(Spoofchecker, setChecks) } /* }}} */ -#if U_ICU_VERSION_MAJOR_NUM >= 51 +#if U_ICU_VERSION_MAJOR_NUM >= 58 /* {{{ proto void Spoofchecker::setRestrictionLevel( int $restriction_level ) * Set the loosest restriction level allowed for strings. */ @@ -150,9 +150,7 @@ PHP_METHOD(Spoofchecker, setRestrictionLevel) SPOOFCHECKER_METHOD_FETCH_OBJECT; if (USPOOF_ASCII != level && -#if U_ICU_VERSION_MAJOR_NUM >= 53 USPOOF_SINGLE_SCRIPT_RESTRICTIVE != level && -#endif USPOOF_HIGHLY_RESTRICTIVE != level && USPOOF_MODERATELY_RESTRICTIVE != level && USPOOF_MINIMALLY_RESTRICTIVE != level && diff --git a/ext/intl/spoofchecker/spoofchecker_main.h b/ext/intl/spoofchecker/spoofchecker_main.h index c9deab4445..227f0e8481 100644 --- a/ext/intl/spoofchecker/spoofchecker_main.h +++ b/ext/intl/spoofchecker/spoofchecker_main.h @@ -23,7 +23,7 @@ PHP_METHOD(Spoofchecker, isSuspicious); PHP_METHOD(Spoofchecker, areConfusable); PHP_METHOD(Spoofchecker, setAllowedLocales); PHP_METHOD(Spoofchecker, setChecks); -#if U_ICU_VERSION_MAJOR_NUM >= 51 +#if U_ICU_VERSION_MAJOR_NUM >= 58 PHP_METHOD(Spoofchecker, setRestrictionLevel); #endif |