Skip to content

Close GH-16659: Bump ICU requirement to ICU >= 57.1 #16688

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/php.m4
Original file line number Diff line number Diff line change
Expand Up @@ -1779,7 +1779,7 @@ dnl
dnl Common setup macro for ICU.
dnl
AC_DEFUN([PHP_SETUP_ICU],[
PKG_CHECK_MODULES([ICU], [icu-uc >= 50.1 icu-io icu-i18n])
PKG_CHECK_MODULES([ICU], [icu-uc >= 57.1 icu-io icu-i18n])

PHP_EVAL_INCLINE([$ICU_CFLAGS])
PHP_EVAL_LIBLINE([$ICU_LIBS], [$1])
Expand Down
2 changes: 0 additions & 2 deletions ext/intl/formatter/formatter.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ class NumberFormatter
public const int PATTERN_RULEBASED = UNKNOWN;
/** @cvalue UNUM_IGNORE */
public const int IGNORE = UNKNOWN;
#if U_ICU_VERSION_MAJOR_NUM >= 53
/** @cvalue UNUM_CURRENCY_ACCOUNTING */
public const int CURRENCY_ACCOUNTING = UNKNOWN;
#endif
/** @cvalue UNUM_DEFAULT */
public const int DEFAULT_STYLE = UNKNOWN;

Expand Down
4 changes: 1 addition & 3 deletions ext/intl/formatter/formatter_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 0 additions & 14 deletions ext/intl/normalizer/normalizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,6 @@

#include <php.h>
#include <unicode/utypes.h>
#if U_ICU_VERSION_MAJOR_NUM < 56
#include <unicode/unorm.h>

#define NORMALIZER_FORM_D UNORM_NFD
#define NORMALIZER_NFD UNORM_NFD
#define NORMALIZER_FORM_KD UNORM_NFKD
#define NORMALIZER_NFKD UNORM_NFKD
#define NORMALIZER_FORM_C UNORM_NFC
#define NORMALIZER_NFC UNORM_NFC
#define NORMALIZER_FORM_KC UNORM_NFKC
#define NORMALIZER_NFKC UNORM_NFKC
#define NORMALIZER_DEFAULT UNORM_DEFAULT
#else
#include <unicode/unorm2.h>

#define NORMALIZER_FORM_D 0x4
Expand All @@ -43,6 +30,5 @@
#define NORMALIZER_FORM_KC_CF 0x30
#define NORMALIZER_NFKC_CF NORMALIZER_FORM_KC_CF
#define NORMALIZER_DEFAULT NORMALIZER_FORM_C
#endif

#endif // NORMALIZER_NORMALIZER_H
4 changes: 0 additions & 4 deletions ext/intl/normalizer/normalizer.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ class Normalizer
public const int FORM_KC = UNKNOWN;
/** @cvalue NORMALIZER_NFKC */
public const int NFKC = UNKNOWN;
#if U_ICU_VERSION_MAJOR_NUM >= 56
/** @cvalue NORMALIZER_FORM_KC_CF */
public const int FORM_KC_CF = UNKNOWN;
/** @cvalue NORMALIZER_NFKC_CF */
public const int NFKC_CF = UNKNOWN;
#endif

/**
* @tentative-return-type
Expand All @@ -39,11 +37,9 @@ public static function normalize(string $string, int $form = Normalizer::FORM_C)
*/
public static function isNormalized(string $string, int $form = Normalizer::FORM_C): bool {}

#if U_ICU_VERSION_MAJOR_NUM >= 56
/**
* @tentative-return-type
* @alias normalizer_get_raw_decomposition
*/
public static function getRawDecomposition(string $string, int $form = Normalizer::FORM_C): ?string {}
#endif
}
12 changes: 1 addition & 11 deletions ext/intl/normalizer/normalizer_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 0 additions & 24 deletions ext/intl/normalizer/normalizer_normalize.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,13 @@
#endif

#include "php_intl.h"
#if U_ICU_VERSION_MAJOR_NUM < 56
#include "unicode/unorm.h"
#else
#include <unicode/unorm2.h>
#endif
#include "normalizer.h"
#include "normalizer_class.h"
#include "intl_convert.h"
#include <unicode/utf8.h>


#if U_ICU_VERSION_MAJOR_NUM >= 56
static const UNormalizer2 *intl_get_normalizer(zend_long form, UErrorCode *err)
{/*{{{*/
switch (form)
Expand Down Expand Up @@ -74,7 +69,6 @@ static UBool intl_is_normalized(zend_long form, const UChar *uinput, int32_t uin

return unorm2_isNormalized(norm, uinput, uinput_len, err);
}/*}}}*/
#endif

/* {{{ Normalize a string. */
PHP_FUNCTION( normalizer_normalize )
Expand Down Expand Up @@ -116,9 +110,7 @@ PHP_FUNCTION( normalizer_normalize )
break;
case NORMALIZER_FORM_C:
case NORMALIZER_FORM_KC:
#if U_ICU_VERSION_MAJOR_NUM >= 56
case NORMALIZER_FORM_KC_CF:
#endif
break;
default:
zend_argument_value_error(2, "must be a a valid normalization form");
Expand Down Expand Up @@ -151,11 +143,7 @@ PHP_FUNCTION( normalizer_normalize )
uret_buf = eumalloc( uret_len + 1 );

/* normalize */
#if U_ICU_VERSION_MAJOR_NUM < 56
size_needed = unorm_normalize( uinput, uinput_len, form, (int32_t) 0 /* options */, uret_buf, uret_len, &status);
#else
size_needed = intl_normalize(form, uinput, uinput_len, uret_buf, uret_len, &status);
#endif

/* Bail out if an unexpected error occurred.
* (U_BUFFER_OVERFLOW_ERROR means that *target buffer is not large enough).
Expand All @@ -179,11 +167,7 @@ PHP_FUNCTION( normalizer_normalize )
status = U_ZERO_ERROR;

/* try normalize again */
#if U_ICU_VERSION_MAJOR_NUM < 56
size_needed = unorm_normalize( uinput, uinput_len, form, (int32_t) 0 /* options */, uret_buf, uret_len, &status);
#else
size_needed = intl_normalize(form, uinput, uinput_len, uret_buf, uret_len, &status);
#endif

/* Bail out if an unexpected error occurred. */
if( U_FAILURE(status) ) {
Expand Down Expand Up @@ -243,9 +227,7 @@ PHP_FUNCTION( normalizer_is_normalized )
case NORMALIZER_FORM_KD:
case NORMALIZER_FORM_C:
case NORMALIZER_FORM_KC:
#if U_ICU_VERSION_MAJOR_NUM >= 56
case NORMALIZER_FORM_KC_CF:
#endif
break;
default:
zend_argument_value_error(2, "must be a a valid normalization form");
Expand Down Expand Up @@ -275,11 +257,7 @@ PHP_FUNCTION( normalizer_is_normalized )


/* test string */
#if U_ICU_VERSION_MAJOR_NUM < 56
uret = unorm_isNormalizedWithOptions( uinput, uinput_len, form, (int32_t) 0 /* options */, &status);
#else
uret = intl_is_normalized(form, uinput, uinput_len, &status);
#endif

efree( uinput );

Expand All @@ -298,7 +276,6 @@ PHP_FUNCTION( normalizer_is_normalized )
/* }}} */

/* {{{ Returns the Decomposition_Mapping property for the given UTF-8 encoded code point. */
#if U_ICU_VERSION_MAJOR_NUM >= 56
PHP_FUNCTION( normalizer_get_raw_decomposition )
{
char* input = NULL;
Expand Down Expand Up @@ -344,5 +321,4 @@ PHP_FUNCTION( normalizer_get_raw_decomposition )

RETVAL_NEW_STR(intl_convert_utf16_to_utf8(decomposition, decomposition_length, &status));
}
#endif
/* }}} */
4 changes: 0 additions & 4 deletions ext/intl/php_intl.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -537,9 +537,7 @@ function normalizer_normalize(string $string, int $form = Normalizer::FORM_C): s

function normalizer_is_normalized(string $string, int $form = Normalizer::FORM_C): bool {}

#if U_ICU_VERSION_MAJOR_NUM >= 56
function normalizer_get_raw_decomposition(string $string, int $form = Normalizer::FORM_C): ?string {}
#endif

/* resourceboundle */

Expand Down Expand Up @@ -605,11 +603,9 @@ function intltz_get_tz_data_version(): string|false {}

function intltz_get_unknown(): IntlTimeZone {}

#if U_ICU_VERSION_MAJOR_NUM >= 52
function intltz_get_windows_id(string $timezoneId): string|false {}

function intltz_get_id_for_windows_id(string $timezoneId, ?string $region = null): string|false {}
#endif

function intltz_has_same_rules(IntlTimeZone $timezone, IntlTimeZone $other): bool {}

Expand Down
18 changes: 2 additions & 16 deletions ext/intl/php_intl_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 0 additions & 19 deletions ext/intl/tests/breakiter_getLocale_basic.phpt

This file was deleted.

1 change: 0 additions & 1 deletion ext/intl/tests/breakiter_getLocale_basic2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ IntlBreakIterator::getLocale(): basic test
--EXTENSIONS--
intl
--SKIPIF--
<?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.1'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '64.0') >= 0) die('skip for ICU < 64.0'); ?>
--FILE--
<?php
Expand Down
2 changes: 0 additions & 2 deletions ext/intl/tests/bug53735.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
Bug #53735 NumberFormatter returns NaN when converting float point
--EXTENSIONS--
intl
--SKIPIF--
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0) die('skip for ICU >= 51.2'); ?>
--FILE--
<?php

Expand Down
Loading