Skip to content

Commit 7c3dfbb

Browse files
committed
intl extension, build fix for icu >= 69.x release. ubrk/ucnv_safeClone had been deprecated in favor of ubrk/ucnv_clone which does not use user provided stacks but remain thread safe.
1 parent bd67933 commit 7c3dfbb

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

NEWS

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ PHP NEWS
1818
. Fixed bug GH-8848 (imagecopyresized() error refers to the wrong argument).
1919
(cmb)
2020

21+
- Intl:
22+
. Fixed build for ICU 69.x and onwards. (David Carlier)
23+
2124
- OPcache:
2225
. Fixed bug GH-8847 (PHP hanging infinitly at 100% cpu when check php
2326
syntaxe of a valid file). (Dmitry)

ext/intl/converter/converter.c

+8
Original file line numberDiff line numberDiff line change
@@ -933,10 +933,18 @@ static zend_object *php_converter_clone_object(zend_object *object) {
933933

934934
intl_errors_reset(&oldobj->error);
935935

936+
#if U_ICU_VERSION_MAJOR_NUM > 70
937+
objval->src = ucnv_clone(oldobj->src, &error);
938+
#else
936939
objval->src = ucnv_safeClone(oldobj->src, NULL, NULL, &error);
940+
#endif
937941
if (U_SUCCESS(error)) {
938942
error = U_ZERO_ERROR;
943+
#if U_ICU_VERSION_MAJOR_NUM > 70
944+
objval->dest = ucnv_clone(oldobj->dest, &error);
945+
#else
939946
objval->dest = ucnv_safeClone(oldobj->dest, NULL, NULL, &error);
947+
#endif
940948
}
941949
if (U_FAILURE(error)) {
942950
zend_string *err_msg;

ext/intl/grapheme/grapheme_util.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,6 @@ grapheme_strrpos_ascii(char *haystack, size_t haystack_len, char *needle, size_t
373373
/* {{{ grapheme_get_break_iterator: get a clone of the global character break iterator */
374374
UBreakIterator* grapheme_get_break_iterator(void *stack_buffer, UErrorCode *status )
375375
{
376-
int32_t buffer_size;
377-
378376
UBreakIterator *global_break_iterator = INTL_G( grapheme_iterator );
379377

380378
if ( NULL == global_break_iterator ) {
@@ -388,8 +386,12 @@ UBreakIterator* grapheme_get_break_iterator(void *stack_buffer, UErrorCode *stat
388386
INTL_G(grapheme_iterator) = global_break_iterator;
389387
}
390388

391-
buffer_size = U_BRK_SAFECLONE_BUFFERSIZE;
389+
#if U_ICU_VERSION_MAJOR_NUM >= 69
390+
return ubrk_clone(global_break_iterator, status);
391+
#else
392+
int32_t buffer_size = U_BRK_SAFECLONE_BUFFERSIZE;
392393

393394
return ubrk_safeClone(global_break_iterator, stack_buffer, &buffer_size, status);
395+
#endif
394396
}
395397
/* }}} */

0 commit comments

Comments
 (0)