Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9a8e7b5

Browse files
committed
Use recommended way to handle utf*.h headers and obsolete symbols
1 parent 863aedd commit 9a8e7b5

File tree

7 files changed

+21
-4
lines changed

7 files changed

+21
-4
lines changed

acinclude.m4

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2241,6 +2241,10 @@ AC_DEFUN([PHP_SETUP_ICU],[
22412241
ICU_CXXFLAGS=`$ICU_CONFIG --cxxflags`
22422242
if test "$icu_version" -ge "49000"; then
22432243
ICU_CXXFLAGS="$ICU_CXXFLAGS -DUNISTR_FROM_CHAR_EXPLICIT=explicit -DUNISTR_FROM_STRING_EXPLICIT=explicit"
2244+
ICU_CFLAGS="-DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1"
2245+
fi
2246+
if test "$icu_version" -ge "60000"; then
2247+
ICU_CFLAGS="$ICU_CFLAGS -DU_HIDE_OBSOLETE_UTF_OLD_H=1"
22442248
fi
22452249
fi
22462250
])

ext/intl/config.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if test "$PHP_INTL" != "no"; then
99
PHP_SETUP_ICU(INTL_SHARED_LIBADD)
1010
PHP_SUBST(INTL_SHARED_LIBADD)
1111
PHP_REQUIRE_CXX()
12-
INTL_COMMON_FLAGS="$ICU_INCS -Wno-write-strings -D__STDC_LIMIT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
12+
INTL_COMMON_FLAGS="$ICU_INCS $ICU_CFLAGS -Wno-write-strings -D__STDC_LIMIT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
1313
if test "$icu_version" -ge "4002"; then
1414
icu_spoof_src=" spoofchecker/spoofchecker_class.c \
1515
spoofchecker/spoofchecker.c\

ext/intl/config.w32

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ if (PHP_INTL != "no") {
129129
ADD_FLAG("LIBS_INTL", "iculx.lib");
130130
}
131131

132-
ADD_FLAG("CFLAGS_INTL", "/EHsc /DUNISTR_FROM_CHAR_EXPLICIT=explicit /DUNISTR_FROM_STRING_EXPLICIT=explicit");
132+
ADD_FLAG("CFLAGS_INTL", "/EHsc /DUNISTR_FROM_CHAR_EXPLICIT=explicit /DUNISTR_FROM_STRING_EXPLICIT=explicit /DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1 /DU_HIDE_OBSOLETE_UTF_OLD_H=1");
133133
AC_DEFINE("HAVE_INTL", 1, "Internationalization support enabled");
134134
} else {
135135
WARNING("intl not enabled; libraries and/or headers not found");

ext/intl/converter/converter.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
#include "zend_exceptions.h"
1919

2020
#include <unicode/utypes.h>
21+
#if U_ICU_VERSION_MAJOR_NUM >= 49
22+
#include <unicode/utf8.h>
23+
#include <unicode/utf16.h>
24+
#endif
2125
#include <unicode/ucnv.h>
2226
#include <unicode/ustring.h>
2327

ext/intl/grapheme/grapheme_string.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
#include "grapheme_util.h"
2525

2626
#include <unicode/utypes.h>
27+
#if U_ICU_VERSION_MAJOR_NUM >= 49
28+
#include <unicode/utf8.h>
29+
#endif
2730
#include <unicode/ucol.h>
2831
#include <unicode/ustring.h>
2932
#include <unicode/ubrk.h>
@@ -835,10 +838,10 @@ PHP_FUNCTION(grapheme_extract)
835838
pstr = str + start;
836839

837840
/* just in case pstr points in the middle of a character, move forward to the start of the next char */
838-
if ( !UTF8_IS_SINGLE(*pstr) && !U8_IS_LEAD(*pstr) ) {
841+
if ( !U8_IS_SINGLE(*pstr) && !U8_IS_LEAD(*pstr) ) {
839842
char *str_end = str + str_len;
840843

841-
while ( !UTF8_IS_SINGLE(*pstr) && !U8_IS_LEAD(*pstr) ) {
844+
while ( !U8_IS_SINGLE(*pstr) && !U8_IS_LEAD(*pstr) ) {
842845
pstr++;
843846
if ( pstr >= str_end ) {
844847
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,

ext/intl/normalizer/normalizer_normalize.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
#include "normalizer_class.h"
2525
#include "normalizer_normalize.h"
2626
#include "intl_convert.h"
27+
#if U_ICU_VERSION_MAJOR_NUM >= 49
28+
#include <unicode/utf8.h>
29+
#endif
2730

2831
/* {{{ proto string Normalizer::normalize( string $input [, string $form = FORM_C] )
2932
* Normalize a string. }}} */

ext/intl/uchar/uchar.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
#include "intl_convert.h"
44

55
#include <unicode/uchar.h>
6+
#if U_ICU_VERSION_MAJOR_NUM >= 49
7+
#include <unicode/utf8.h>
8+
#endif
69

710
#define IC_METHOD(mname) PHP_METHOD(IntlChar, mname)
811

0 commit comments

Comments
 (0)