Skip to content

Commit abc304b

Browse files
committed
Remove locale for grapheme_levenshetin
1 parent f72e59f commit abc304b

File tree

4 files changed

+3
-13
lines changed

4 files changed

+3
-13
lines changed

ext/intl/grapheme/grapheme_string.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -932,8 +932,6 @@ PHP_FUNCTION(grapheme_levenshtein)
932932
zend_long cost_ins = 1;
933933
zend_long cost_rep = 1;
934934
zend_long cost_del = 1;
935-
char *locale = "";
936-
size_t locale_len = 0;
937935

938936
ZEND_PARSE_PARAMETERS_START(2, 5)
939937
Z_PARAM_STR(string1)
@@ -942,7 +940,6 @@ PHP_FUNCTION(grapheme_levenshtein)
942940
Z_PARAM_LONG(cost_ins)
943941
Z_PARAM_LONG(cost_rep)
944942
Z_PARAM_LONG(cost_del)
945-
Z_PARAM_STRING(locale, locale_len)
946943
ZEND_PARSE_PARAMETERS_END();
947944

948945
if (cost_ins <= 0 || cost_ins > UINT_MAX / 4) {
@@ -1059,7 +1056,7 @@ PHP_FUNCTION(grapheme_levenshtein)
10591056
RETVAL_FALSE;
10601057
goto out_bi2;
10611058
}
1062-
UCollator *collator = ucol_open(locale, &ustatus);
1059+
UCollator *collator = ucol_open("", &ustatus);
10631060
if (U_FAILURE(ustatus)) {
10641061
intl_error_set_code(NULL, ustatus);
10651062

ext/intl/php_intl.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ function grapheme_stristr(string $haystack, string $needle, bool $beforeNeedle =
447447

448448
function grapheme_str_split(string $string, int $length = 1): array|false {}
449449

450-
function grapheme_levenshtein(string $string1, string $string2, int $insertion_cost = 1, int $replacement_cost = 1, int $deletion_cost = 1, string $locale = ""): int|false {}
450+
function grapheme_levenshtein(string $string1, string $string2, int $insertion_cost = 1, int $replacement_cost = 1, int $deletion_cost = 1): int|false {}
451451

452452
/** @param int $next */
453453
function grapheme_extract(string $haystack, int $size, int $type = GRAPHEME_EXTR_COUNT, int $offset = 0, &$next = null): string|false {}

ext/intl/php_intl_arginfo.h

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/intl/tests/grapheme_levenshtein.phpt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,6 @@ try {
8181
echo $e->getMessage() . PHP_EOL;
8282
}
8383

84-
echo '--- Locale string ---' . \PHP_EOL;
85-
var_dump(grapheme_stripos("i", "\u{0130}", 0, "tr_TR"));
86-
var_dump(grapheme_stripos("i", "\u{0130}", 0, "en_US"));
8784
?>
8885
--EXPECTF--
8986
--- Equal ---
@@ -130,6 +127,3 @@ int(0)
130127
grapheme_levenshtein(): Argument #3 ($insertion_cost) must be greater than 0 and less than or equal to %d
131128
grapheme_levenshtein(): Argument #4 ($replacement_cost) must be greater than 0 and less than or equal to %d
132129
grapheme_levenshtein(): Argument #5 ($deletion_cost) must be greater than 0 and less than or equal to %d
133-
--- Locale string ---
134-
int(0)
135-
bool(false)

0 commit comments

Comments
 (0)