Skip to content

Commit 3dfb133

Browse files
committed
ext/intl: Expose Spoofchecker restriction-level APIs on all supported ICU versions
1 parent 37bb1c3 commit 3dfb133

7 files changed

Lines changed: 24 additions & 34 deletions

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 8.4.22
44

5+
- Intl:
6+
. Expose Spoofchecker restriction-level APIs on all supported ICU
7+
versions. (Weilin Du)
8+
59
- MySQLnd:
610
. Fix persistent free of non-persistent connect_attr key (David Carlier).
711

ext/intl/spoofchecker/spoofchecker.stub.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ class Spoofchecker
1919
public const int INVISIBLE = UNKNOWN;
2020
/** @cvalue USPOOF_CHAR_LIMIT */
2121
public const int CHAR_LIMIT = UNKNOWN;
22-
#if U_ICU_VERSION_MAJOR_NUM >= 58
2322
/** @cvalue USPOOF_ASCII */
2423
public const int ASCII = UNKNOWN;
2524
/** @cvalue USPOOF_HIGHLY_RESTRICTIVE */
@@ -34,7 +33,6 @@ class Spoofchecker
3433
public const int SINGLE_SCRIPT_RESTRICTIVE = UNKNOWN;
3534
/** @cvalue USPOOF_MIXED_NUMBERS */
3635
public const int MIXED_NUMBERS = UNKNOWN;
37-
#endif
3836
#if U_ICU_VERSION_MAJOR_NUM >= 62
3937
/** @cvalue USPOOF_HIDDEN_OVERLAY */
4038
public const int HIDDEN_OVERLAY = UNKNOWN;
@@ -71,9 +69,7 @@ public function setAllowedLocales(string $locales): void {}
7169
/** @tentative-return-type */
7270
public function setChecks(int $checks): void {}
7371

74-
#if U_ICU_VERSION_MAJOR_NUM >= 58
7572
/** @tentative-return-type */
7673
public function setRestrictionLevel(int $level): void {}
77-
#endif
7874
public function setAllowedChars(string $pattern, int $patternOptions = 0): void {}
7975
}

ext/intl/spoofchecker/spoofchecker_arginfo.h

Lines changed: 0 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/intl/spoofchecker/spoofchecker_main.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ PHP_METHOD(Spoofchecker, setChecks)
135135
}
136136
/* }}} */
137137

138-
#if U_ICU_VERSION_MAJOR_NUM >= 58
139138
/* TODO Document this method on PHP.net */
140139
/* {{{ Set the loosest restriction level allowed for strings. */
141140
PHP_METHOD(Spoofchecker, setRestrictionLevel)
@@ -164,7 +163,6 @@ PHP_METHOD(Spoofchecker, setRestrictionLevel)
164163
uspoof_setRestrictionLevel(co->uspoof, (URestrictionLevel)level);
165164
}
166165
/* }}} */
167-
#endif
168166

169167
PHP_METHOD(Spoofchecker, setAllowedChars)
170168
{

ext/intl/tests/spoofchecker_007.phpt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ spoofchecker with restriction level
44
intl
55
--SKIPIF--
66
<?php if(!class_exists("Spoofchecker")) print 'skip'; ?>
7-
<?php
8-
$r = new ReflectionClass("SpoofChecker");
9-
if (false === $r->getConstant("SINGLE_SCRIPT_RESTRICTIVE")) {
10-
die("skip Incompatible ICU version");
11-
}
12-
?>
137
--FILE--
148
<?php
159

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
Spoofchecker exposes restriction-level APIs on all supported ICU versions
3+
--EXTENSIONS--
4+
intl
5+
--SKIPIF--
6+
<?php if (!class_exists("Spoofchecker")) print 'skip'; ?>
7+
--FILE--
8+
<?php
9+
$r = new ReflectionClass("Spoofchecker");
10+
11+
var_dump($r->getConstant("ASCII") !== false);
12+
var_dump($r->getConstant("SINGLE_SCRIPT_RESTRICTIVE") !== false);
13+
var_dump($r->getConstant("MIXED_NUMBERS") !== false);
14+
var_dump($r->hasMethod("setRestrictionLevel"));
15+
?>
16+
--EXPECT--
17+
bool(true)
18+
bool(true)
19+
bool(true)
20+
bool(true)

ext/intl/tests/spoofchecker_unknown_restriction_level.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ intl
55
--SKIPIF--
66
<?php
77
if (!class_exists("Spoofchecker")) print 'skip';
8-
9-
if (!method_exists(new Spoofchecker(), 'setRestrictionLevel')) print 'skip ICU version < 58';
108
?>
119
--FILE--
1210
<?php

0 commit comments

Comments
 (0)