@@ -334,7 +334,7 @@ static const mbfl_encoding *php_mb_get_encoding(zend_string *encoding_name) {
334
334
335
335
encoding = mbfl_name2encoding (ZSTR_VAL (encoding_name ));
336
336
if (!encoding ) {
337
- php_error_docref ( NULL , E_WARNING , "Unknown encoding \"%s\"" , ZSTR_VAL (encoding_name ));
337
+ zend_value_error ( "Unknown encoding \"%s\"" , ZSTR_VAL (encoding_name ));
338
338
return NULL ;
339
339
}
340
340
@@ -1400,8 +1400,8 @@ PHP_FUNCTION(mb_language)
1400
1400
} else {
1401
1401
zend_string * ini_name = zend_string_init ("mbstring.language" , sizeof ("mbstring.language" ) - 1 , 0 );
1402
1402
if (FAILURE == zend_alter_ini_entry (ini_name , name , PHP_INI_USER , PHP_INI_STAGE_RUNTIME )) {
1403
- php_error_docref ( NULL , E_WARNING , "Unknown language \"%s\"" , ZSTR_VAL (name ));
1404
- RETVAL_FALSE ;
1403
+ zend_value_error ( "Unknown language \"%s\"" , ZSTR_VAL (name ));
1404
+ return ;
1405
1405
} else {
1406
1406
RETVAL_TRUE ;
1407
1407
}
@@ -1431,8 +1431,8 @@ PHP_FUNCTION(mb_internal_encoding)
1431
1431
} else {
1432
1432
encoding = mbfl_name2encoding (name );
1433
1433
if (!encoding ) {
1434
- php_error_docref ( NULL , E_WARNING , "Unknown encoding \"%s\"" , name );
1435
- RETURN_FALSE ;
1434
+ zend_value_error ( "Unknown encoding \"%s\"" , name );
1435
+ return ;
1436
1436
} else {
1437
1437
MBSTRG (current_internal_encoding ) = encoding ;
1438
1438
MBSTRG (internal_encoding_set ) = 1 ;
@@ -1556,8 +1556,8 @@ PHP_FUNCTION(mb_http_output)
1556
1556
} else {
1557
1557
encoding = mbfl_name2encoding (name );
1558
1558
if (!encoding ) {
1559
- php_error_docref ( NULL , E_WARNING , "Unknown encoding \"%s\"" , name );
1560
- RETURN_FALSE ;
1559
+ zend_value_error ( "Unknown encoding \"%s\"" , name );
1560
+ return ;
1561
1561
} else {
1562
1562
MBSTRG (http_output_set ) = 1 ;
1563
1563
MBSTRG (current_http_output_encoding ) = encoding ;
@@ -1712,21 +1712,21 @@ PHP_FUNCTION(mb_preferred_mime_name)
1712
1712
1713
1713
if (zend_parse_parameters (ZEND_NUM_ARGS (), "s" , & name , & name_len ) == FAILURE ) {
1714
1714
return ;
1715
- } else {
1716
- no_encoding = mbfl_name2no_encoding (name );
1717
- if (no_encoding == mbfl_no_encoding_invalid ) {
1718
- php_error_docref (NULL , E_WARNING , "Unknown encoding \"%s\"" , name );
1719
- RETVAL_FALSE ;
1720
- } else {
1721
- const char * preferred_name = mbfl_no2preferred_mime_name (no_encoding );
1722
- if (preferred_name == NULL || * preferred_name == '\0' ) {
1723
- php_error_docref (NULL , E_WARNING , "No MIME preferred name corresponding to \"%s\"" , name );
1724
- RETVAL_FALSE ;
1725
- } else {
1726
- RETVAL_STRING ((char * )preferred_name );
1727
- }
1728
- }
1729
1715
}
1716
+
1717
+ no_encoding = mbfl_name2no_encoding (name );
1718
+ if (no_encoding == mbfl_no_encoding_invalid ) {
1719
+ zend_value_error ("Unknown encoding \"%s\"" , name );
1720
+ return ;
1721
+ }
1722
+
1723
+ const char * preferred_name = mbfl_no2preferred_mime_name (no_encoding );
1724
+ if (preferred_name == NULL || * preferred_name == '\0' ) {
1725
+ zend_value_error ("No MIME preferred name corresponding to \"%s\"" , name );
1726
+ return ;
1727
+ }
1728
+
1729
+ RETVAL_STRING ((char * )preferred_name );
1730
1730
}
1731
1731
/* }}} */
1732
1732
@@ -1928,8 +1928,8 @@ PHP_FUNCTION(mb_str_split)
1928
1928
ZEND_PARSE_PARAMETERS_END ();
1929
1929
1930
1930
if (split_length <= 0 ) {
1931
- php_error_docref ( NULL , E_WARNING , "The length of each segment must be greater than zero" );
1932
- RETURN_FALSE ;
1931
+ zend_value_error ( "The length of each segment must be greater than zero" );
1932
+ return ;
1933
1933
}
1934
1934
1935
1935
/* fill mbfl_string structure */
@@ -2105,14 +2105,14 @@ PHP_FUNCTION(mb_strpos)
2105
2105
offset += slen ;
2106
2106
}
2107
2107
if (offset < 0 || offset > slen ) {
2108
- php_error_docref ( NULL , E_WARNING , "Offset not contained in string" );
2109
- RETURN_FALSE ;
2108
+ zend_value_error ( "Offset not contained in string" );
2109
+ return ;
2110
2110
}
2111
2111
}
2112
2112
2113
2113
if (needle .len == 0 ) {
2114
- php_error_docref ( NULL , E_WARNING , "Empty delimiter" );
2115
- RETURN_FALSE ;
2114
+ zend_value_error ( "Empty delimiter" );
2115
+ return ;
2116
2116
}
2117
2117
2118
2118
n = mbfl_strpos (& haystack , & needle , offset , reverse );
@@ -2123,17 +2123,17 @@ PHP_FUNCTION(mb_strpos)
2123
2123
case 1 :
2124
2124
break ;
2125
2125
case 2 :
2126
- php_error_docref ( NULL , E_WARNING , "Needle has not positive length" );
2127
- break ;
2126
+ zend_value_error ( "Needle has not positive length" );
2127
+ return ;
2128
2128
case 4 :
2129
- php_error_docref ( NULL , E_WARNING , "Unknown encoding or conversion error" );
2130
- break ;
2129
+ zend_value_error ( "Unknown encoding or conversion error" );
2130
+ return ;
2131
2131
case 8 :
2132
- php_error_docref ( NULL , E_NOTICE , "Argument is empty" );
2133
- break ;
2132
+ zend_value_error ( "Argument is empty" );
2133
+ return ;
2134
2134
default :
2135
- php_error_docref ( NULL , E_WARNING , "Unknown error in mb_strpos" );
2136
- break ;
2135
+ zend_value_error ( "Unknown error in mb_strpos" );
2136
+ return ;
2137
2137
}
2138
2138
RETVAL_FALSE ;
2139
2139
}
@@ -2195,8 +2195,8 @@ PHP_FUNCTION(mb_strrpos)
2195
2195
size_t haystack_char_len = mbfl_strlen (& haystack );
2196
2196
if ((offset > 0 && offset > haystack_char_len ) ||
2197
2197
(offset < 0 && - offset > haystack_char_len )) {
2198
- php_error_docref ( NULL , E_WARNING , "Offset is greater than the length of haystack string" );
2199
- RETURN_FALSE ;
2198
+ zend_value_error ( "Offset is greater than the length of haystack string" );
2199
+ return ;
2200
2200
}
2201
2201
}
2202
2202
@@ -2223,8 +2223,8 @@ PHP_FUNCTION(mb_stripos)
2223
2223
}
2224
2224
2225
2225
if (needle .len == 0 ) {
2226
- php_error_docref ( NULL , E_WARNING , "Empty delimiter" );
2227
- RETURN_FALSE ;
2226
+ zend_value_error ( "Empty delimiter" );
2227
+ return ;
2228
2228
}
2229
2229
2230
2230
n = php_mb_stripos (0 , (char * )haystack .val , haystack .len , (char * )needle .val , needle .len , offset , from_encoding );
@@ -2280,8 +2280,8 @@ PHP_FUNCTION(mb_strstr)
2280
2280
}
2281
2281
2282
2282
if (needle .len == 0 ) {
2283
- php_error_docref ( NULL , E_WARNING , "Empty delimiter" );
2284
- RETURN_FALSE ;
2283
+ zend_value_error ( "Empty delimiter" );
2284
+ return ;
2285
2285
}
2286
2286
2287
2287
n = mbfl_strpos (& haystack , & needle , 0 , 0 );
@@ -2384,8 +2384,8 @@ PHP_FUNCTION(mb_stristr)
2384
2384
}
2385
2385
2386
2386
if (!needle .len ) {
2387
- php_error_docref ( NULL , E_WARNING , "Empty delimiter" );
2388
- RETURN_FALSE ;
2387
+ zend_value_error ( "Empty delimiter" );
2388
+ return ;
2389
2389
}
2390
2390
2391
2391
n = php_mb_stripos (0 , (char * )haystack .val , haystack .len , (char * )needle .val , needle .len , 0 , from_encoding );
@@ -2480,8 +2480,8 @@ PHP_FUNCTION(mb_substr_count)
2480
2480
}
2481
2481
2482
2482
if (needle .len == 0 ) {
2483
- php_error_docref ( NULL , E_WARNING , "Empty substring" );
2484
- RETURN_FALSE ;
2483
+ zend_value_error ( "Empty substring" );
2484
+ return ;
2485
2485
}
2486
2486
2487
2487
n = mbfl_substr_count (& haystack , & needle );
@@ -2678,17 +2678,17 @@ PHP_FUNCTION(mb_strimwidth)
2678
2678
}
2679
2679
2680
2680
if (from < 0 || (size_t )from > str_len ) {
2681
- php_error_docref ( NULL , E_WARNING , "Start position is out of range" );
2682
- RETURN_FALSE ;
2681
+ zend_value_error ( "Start position is out of range" );
2682
+ return ;
2683
2683
}
2684
2684
2685
2685
if (width < 0 ) {
2686
2686
width = swidth + width - from ;
2687
2687
}
2688
2688
2689
2689
if (width < 0 ) {
2690
- php_error_docref ( NULL , E_WARNING , "Width is out of range" );
2691
- RETURN_FALSE ;
2690
+ zend_value_error ( "Width is out of range" );
2691
+ return ;
2692
2692
}
2693
2693
2694
2694
if (trimmarker ) {
@@ -2781,7 +2781,7 @@ MBSTRING_API char *php_mb_convert_encoding(const char *input, size_t length, con
2781
2781
if (_to_encoding && strlen (_to_encoding )) {
2782
2782
to_encoding = mbfl_name2encoding (_to_encoding );
2783
2783
if (!to_encoding ) {
2784
- php_error_docref ( NULL , E_WARNING , "Unknown encoding \"%s\"" , _to_encoding );
2784
+ zend_value_error ( "Unknown encoding \"%s\"" , _to_encoding );
2785
2785
return NULL ;
2786
2786
}
2787
2787
} else {
@@ -2874,8 +2874,8 @@ MBSTRING_API HashTable *php_mb_convert_encoding_recursive(HashTable *input, cons
2874
2874
if (key ) {
2875
2875
zend_string_release (key );
2876
2876
}
2877
- php_error_docref ( NULL , E_WARNING , "Object is not supported" );
2878
- continue ;
2877
+ zend_value_error ( "Object is not supported" );
2878
+ return NULL ;
2879
2879
}
2880
2880
if (key ) {
2881
2881
zend_hash_add (output , key , & entry_tmp );
@@ -3013,7 +3013,7 @@ PHP_FUNCTION(mb_convert_case)
3013
3013
}
3014
3014
3015
3015
if (case_mode < 0 || case_mode > PHP_UNICODE_CASE_MODE_MAX ) {
3016
- php_error_docref ( NULL , E_WARNING , "Invalid case mode" );
3016
+ zend_value_error ( "Invalid case mode" );
3017
3017
return ;
3018
3018
}
3019
3019
@@ -3141,7 +3141,8 @@ PHP_FUNCTION(mb_detect_encoding)
3141
3141
break ;
3142
3142
}
3143
3143
if (size == 0 ) {
3144
- php_error_docref (NULL , E_WARNING , "Illegal argument" );
3144
+ zend_value_error ("Illegal argument" );
3145
+ return ;
3145
3146
}
3146
3147
}
3147
3148
@@ -3209,8 +3210,8 @@ PHP_FUNCTION(mb_encoding_aliases)
3209
3210
3210
3211
encoding = mbfl_name2encoding (name );
3211
3212
if (!encoding ) {
3212
- php_error_docref ( NULL , E_WARNING , "Unknown encoding \"%s\"" , name );
3213
- RETURN_FALSE ;
3213
+ zend_value_error ( "Unknown encoding \"%s\"" , name );
3214
+ return ;
3214
3215
}
3215
3216
3216
3217
array_init (return_value );
@@ -3250,8 +3251,8 @@ PHP_FUNCTION(mb_encode_mimeheader)
3250
3251
if (charset_name != NULL ) {
3251
3252
charset = mbfl_name2encoding (charset_name );
3252
3253
if (!charset ) {
3253
- php_error_docref ( NULL , E_WARNING , "Unknown encoding \"%s\"" , charset_name );
3254
- RETURN_FALSE ;
3254
+ zend_value_error ( "Unknown encoding \"%s\"" , charset_name );
3255
+ return ;
3255
3256
}
3256
3257
} else {
3257
3258
const mbfl_language * lang = mbfl_no2language (MBSTRG (language ));
@@ -3520,8 +3521,8 @@ PHP_FUNCTION(mb_convert_variables)
3520
3521
/* new encoding */
3521
3522
to_encoding = mbfl_name2encoding (to_enc );
3522
3523
if (!to_encoding ) {
3523
- php_error_docref ( NULL , E_WARNING , "Unknown encoding \"%s\"" , to_enc );
3524
- RETURN_FALSE ;
3524
+ zend_value_error ( "Unknown encoding \"%s\"" , to_enc );
3525
+ return ;
3525
3526
}
3526
3527
3527
3528
/* initialize string */
@@ -3656,8 +3657,8 @@ php_mb_numericentity_exec(INTERNAL_FUNCTION_PARAMETERS, int type)
3656
3657
if (encoding && encoding_len > 0 ) {
3657
3658
string .encoding = mbfl_name2encoding (encoding );
3658
3659
if (!string .encoding ) {
3659
- php_error_docref ( NULL , E_WARNING , "Unknown encoding \"%s\"" , encoding );
3660
- RETURN_FALSE ;
3660
+ zend_value_error ( "Unknown encoding \"%s\"" , encoding );
3661
+ return ;
3661
3662
}
3662
3663
}
3663
3664
@@ -3965,8 +3966,8 @@ PHP_FUNCTION(mb_send_mail)
3965
3966
str_headers = php_mail_build_headers (headers );
3966
3967
break ;
3967
3968
default :
3968
- php_error_docref ( NULL , E_WARNING , "headers parameter must be string or array" );
3969
- RETURN_FALSE ;
3969
+ zend_type_error ( "headers parameter must be string or array" );
3970
+ return ;
3970
3971
}
3971
3972
}
3972
3973
if (extra_cmd ) {
@@ -4382,7 +4383,7 @@ MBSTRING_API int php_mb_check_encoding(const char *input, size_t length, const c
4382
4383
if (enc != NULL ) {
4383
4384
encoding = mbfl_name2encoding (enc );
4384
4385
if (!encoding || encoding == & mbfl_encoding_pass ) {
4385
- php_error_docref ( NULL , E_WARNING , "Invalid encoding \"%s\"" , enc );
4386
+ zend_value_error ( "Invalid encoding \"%s\"" , enc );
4386
4387
return 0 ;
4387
4388
}
4388
4389
}
@@ -4416,7 +4417,7 @@ MBSTRING_API int php_mb_check_encoding_recursive(HashTable *vars, const zend_str
4416
4417
if (enc != NULL ) {
4417
4418
encoding = mbfl_name2encoding (ZSTR_VAL (enc ));
4418
4419
if (!encoding || encoding == & mbfl_encoding_pass ) {
4419
- php_error_docref ( NULL , E_WARNING , "Invalid encoding \"%s\"" , ZSTR_VAL (enc ));
4420
+ zend_value_error ( "Invalid encoding \"%s\"" , ZSTR_VAL (enc ));
4420
4421
return 0 ;
4421
4422
}
4422
4423
}
@@ -4520,12 +4521,12 @@ static inline zend_long php_mb_ord(const char *str, size_t str_len, zend_string
4520
4521
4521
4522
no_enc = enc -> no_encoding ;
4522
4523
if (php_mb_is_unsupported_no_encoding (no_enc )) {
4523
- php_error_docref ( NULL , E_WARNING , "Unsupported encoding \"%s\"" , ZSTR_VAL (enc_name ));
4524
+ zend_value_error ( "Unsupported encoding \"%s\"" , ZSTR_VAL (enc_name ));
4524
4525
return -1 ;
4525
4526
}
4526
4527
4527
4528
if (str_len == 0 ) {
4528
- php_error_docref ( NULL , E_WARNING , "Empty string" );
4529
+ zend_value_error ( "Empty string" );
4529
4530
return -1 ;
4530
4531
}
4531
4532
@@ -4600,7 +4601,7 @@ static inline zend_string *php_mb_chr(zend_long cp, zend_string *enc_name)
4600
4601
4601
4602
no_enc = enc -> no_encoding ;
4602
4603
if (php_mb_is_unsupported_no_encoding (no_enc )) {
4603
- php_error_docref ( NULL , E_WARNING , "Unsupported encoding \"%s\"" , ZSTR_VAL (enc_name ));
4604
+ zend_value_error ( "Unsupported encoding \"%s\"" , ZSTR_VAL (enc_name ));
4604
4605
return NULL ;
4605
4606
}
4606
4607
@@ -4892,16 +4893,16 @@ MBSTRING_API size_t php_mb_stripos(int mode, const char *old_haystack, size_t ol
4892
4893
if (mode ) {
4893
4894
if ((offset > 0 && (size_t )offset > haystack_char_len ) ||
4894
4895
(offset < 0 && (size_t )(- offset ) > haystack_char_len )) {
4895
- php_error_docref ( NULL , E_WARNING , "Offset is greater than the length of haystack string" );
4896
- break ;
4896
+ zend_value_error ( "Offset is greater than the length of haystack string" );
4897
+ return -1 ;
4897
4898
}
4898
4899
} else {
4899
4900
if (offset < 0 ) {
4900
4901
offset += (zend_long )haystack_char_len ;
4901
4902
}
4902
4903
if (offset < 0 || (size_t )offset > haystack_char_len ) {
4903
- php_error_docref ( NULL , E_WARNING , "Offset not contained in string" );
4904
- break ;
4904
+ zend_value_error ( "Offset not contained in string" );
4905
+ return -1 ;
4905
4906
}
4906
4907
}
4907
4908
}
0 commit comments