@@ -1814,7 +1814,7 @@ static size_t mb_get_strlen(zend_string *string, const mbfl_encoding *encoding)
1814
1814
unsigned int char_len = encoding -> flag & (MBFL_ENCTYPE_SBCS | MBFL_ENCTYPE_WCS2 | MBFL_ENCTYPE_WCS4 );
1815
1815
if (char_len ) {
1816
1816
return ZSTR_LEN (string ) / char_len ;
1817
- } else if (php_mb_is_no_encoding_utf8 (encoding -> no_encoding ) && GC_FLAGS (string ) & IS_STR_VALID_UTF8 ) {
1817
+ } else if (php_mb_is_no_encoding_utf8 (encoding -> no_encoding ) && ZSTR_IS_VALID_UTF8 (string )) {
1818
1818
return mb_fast_strlen_utf8 ((unsigned char * )ZSTR_VAL (string ), ZSTR_LEN (string ));
1819
1819
}
1820
1820
@@ -2263,7 +2263,7 @@ PHP_FUNCTION(mb_substr_count)
2263
2263
if (php_mb_is_no_encoding_utf8 (enc -> no_encoding )) {
2264
2264
/* No need to do any conversion if haystack/needle are already known-valid UTF-8
2265
2265
* (If they are not valid, then not passing them through conversion filters could affect output) */
2266
- if (GC_FLAGS (haystack ) & IS_STR_VALID_UTF8 ) {
2266
+ if (ZSTR_IS_VALID_UTF8 (haystack )) {
2267
2267
haystack_u8 = haystack ;
2268
2268
} else {
2269
2269
unsigned int num_errors = 0 ;
@@ -2273,7 +2273,7 @@ PHP_FUNCTION(mb_substr_count)
2273
2273
}
2274
2274
}
2275
2275
2276
- if (GC_FLAGS (needle ) & IS_STR_VALID_UTF8 ) {
2276
+ if (ZSTR_IS_VALID_UTF8 (needle )) {
2277
2277
needle_u8 = needle ;
2278
2278
} else {
2279
2279
unsigned int num_errors = 0 ;
@@ -3425,7 +3425,7 @@ PHP_FUNCTION(mb_detect_encoding)
3425
3425
strict = MBSTRG (strict_detection );
3426
3426
}
3427
3427
3428
- if (size == 1 && * elist == & mbfl_encoding_utf8 && ( GC_FLAGS ( str ) & IS_STR_VALID_UTF8 )) {
3428
+ if (size == 1 && * elist == & mbfl_encoding_utf8 && ZSTR_IS_VALID_UTF8 ( str )) {
3429
3429
ret = & mbfl_encoding_utf8 ;
3430
3430
} else {
3431
3431
ret = mb_guess_encoding ((unsigned char * )ZSTR_VAL (str ), ZSTR_LEN (str ), elist , size , strict , order_significant );
@@ -5495,7 +5495,7 @@ static bool mb_fast_check_utf8_avx2(zend_string *str)
5495
5495
static bool mb_check_str_encoding (zend_string * str , const mbfl_encoding * encoding )
5496
5496
{
5497
5497
if (encoding == & mbfl_encoding_utf8 ) {
5498
- if (GC_FLAGS (str ) & IS_STR_VALID_UTF8 ) {
5498
+ if (ZSTR_IS_VALID_UTF8 (str )) {
5499
5499
return true;
5500
5500
}
5501
5501
bool result = mb_fast_check_utf8 (str );
@@ -5888,7 +5888,7 @@ PHP_FUNCTION(mb_scrub)
5888
5888
RETURN_THROWS ();
5889
5889
}
5890
5890
5891
- if (enc == & mbfl_encoding_utf8 && ( GC_FLAGS ( str ) & IS_STR_VALID_UTF8 )) {
5891
+ if (enc == & mbfl_encoding_utf8 && ZSTR_IS_VALID_UTF8 ( str )) {
5892
5892
/* A valid UTF-8 string will not be changed by mb_scrub; so just increment the refcount and return it */
5893
5893
RETURN_STR_COPY (str );
5894
5894
}
0 commit comments