Skip to content

Commit 6096835

Browse files
committed
intl extension, build fix for icu >= 71.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 da8bfd4 commit 6096835

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

ext/intl/converter/converter.c

Lines changed: 8 additions & 0 deletions
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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,6 @@ zend_long grapheme_strrpos_ascii(char *haystack, size_t haystack_len, char *need
372372
/* {{{ grapheme_get_break_iterator: get a clone of the global character break iterator */
373373
UBreakIterator* grapheme_get_break_iterator(void *stack_buffer, UErrorCode *status )
374374
{
375-
int32_t buffer_size;
376-
377375
UBreakIterator *global_break_iterator = INTL_G( grapheme_iterator );
378376

379377
if ( NULL == global_break_iterator ) {
@@ -387,8 +385,12 @@ UBreakIterator* grapheme_get_break_iterator(void *stack_buffer, UErrorCode *stat
387385
INTL_G(grapheme_iterator) = global_break_iterator;
388386
}
389387

390-
buffer_size = U_BRK_SAFECLONE_BUFFERSIZE;
388+
#if U_ICU_VERSION_MAJOR_NUM > 70
389+
return ubrk_clone(global_break_iterator, status);
390+
#else
391+
int32_t buffer_size = U_BRK_SAFECLONE_BUFFERSIZE;
391392

392393
return ubrk_safeClone(global_break_iterator, stack_buffer, &buffer_size, status);
394+
#endif
393395
}
394396
/* }}} */

0 commit comments

Comments
 (0)