summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2017-10-30 18:21:14 +0100
committerAnatol Belski <ab@php.net>2017-10-30 18:21:14 +0100
commit3ce3e96af3f273dcdb4f40dfe040126b33659bc5 (patch)
treee89c53facb6aaa55338a2129c337ca77f5758719 /ext
parentc35f69327c6b1798c4fa1ad5c44ece2834bd8ea4 (diff)
downloadphp-git-3ce3e96af3f273dcdb4f40dfe040126b33659bc5.tar.gz
Proper ICU version check for restriction levels availability
Diffstat (limited to 'ext')
-rw-r--r--ext/intl/spoofchecker/spoofchecker_class.c4
-rw-r--r--ext/intl/spoofchecker/spoofchecker_class.h2
-rw-r--r--ext/intl/spoofchecker/spoofchecker_create.c2
-rw-r--r--ext/intl/spoofchecker/spoofchecker_main.c2
-rw-r--r--ext/intl/spoofchecker/spoofchecker_main.h2
5 files changed, 10 insertions, 2 deletions
diff --git a/ext/intl/spoofchecker/spoofchecker_class.c b/ext/intl/spoofchecker/spoofchecker_class.c
index 70ac89db7b..36545beb49 100644
--- a/ext/intl/spoofchecker/spoofchecker_class.c
+++ b/ext/intl/spoofchecker/spoofchecker_class.c
@@ -84,9 +84,11 @@ 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
ZEND_BEGIN_ARG_INFO_EX(spoofchecker_set_restriction_level, 0, 0, 1)
ZEND_ARG_INFO(0, level)
ZEND_END_ARG_INFO()
+#endif
/* }}} */
@@ -100,7 +102,9 @@ 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
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 c0cb0c5327..108bc4a11d 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 >= 58
+#if U_ICU_VERSION_MAJOR_NUM >= 51
#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 8108cafa2f..eb969155c9 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 >= 58
+#if U_ICU_VERSION_MAJOR_NUM >= 51
/* 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 c063e656a4..817fe77622 100644
--- a/ext/intl/spoofchecker/spoofchecker_main.c
+++ b/ext/intl/spoofchecker/spoofchecker_main.c
@@ -134,6 +134,7 @@ PHP_METHOD(Spoofchecker, setChecks)
}
/* }}} */
+#if U_ICU_VERSION_MAJOR_NUM >= 53
/* {{{ proto void Spoofchecker::setRestrictionLevel( int $restriction_level )
* Set the loosest restriction level allowed for strings.
*/
@@ -163,6 +164,7 @@ PHP_METHOD(Spoofchecker, setRestrictionLevel)
uspoof_setRestrictionLevel(co->uspoof, (URestrictionLevel)level);
}
/* }}} */
+#endif
/*
* Local variables:
diff --git a/ext/intl/spoofchecker/spoofchecker_main.h b/ext/intl/spoofchecker/spoofchecker_main.h
index ca26c706a7..c9deab4445 100644
--- a/ext/intl/spoofchecker/spoofchecker_main.h
+++ b/ext/intl/spoofchecker/spoofchecker_main.h
@@ -23,6 +23,8 @@ PHP_METHOD(Spoofchecker, isSuspicious);
PHP_METHOD(Spoofchecker, areConfusable);
PHP_METHOD(Spoofchecker, setAllowedLocales);
PHP_METHOD(Spoofchecker, setChecks);
+#if U_ICU_VERSION_MAJOR_NUM >= 51
PHP_METHOD(Spoofchecker, setRestrictionLevel);
+#endif
#endif // SPOOFCHECKER_MAIN_H