Skip to content

Commit b22d2bf

Browse files
committedJul 6, 2022
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. Closes #8930.
1 parent 012abcd commit b22d2bf

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
@@ -12,6 +12,9 @@ PHP NEWS
1212
. Fixed LMDB driver hanging when attempting to delete a non-existing key
1313
(Girgias)
1414

15+
- Intl:
16+
. Fixed build for ICU 69.x and onwards. (David Carlier)
17+
1518
- Opcache:
1619
. Allocate JIT buffer close to PHP .text segemnt to allow using direct
1720
IP-relative calls and jumps.

‎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
@@ -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 >= 69
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)