@@ -663,7 +663,7 @@ static void *_php_mb_compile_regex(const char *pattern)
663
663
ONIG_ENCODING_ASCII , & OnigSyntaxPerl , & err_info ))) {
664
664
OnigUChar err_str [ONIG_MAX_ERROR_MESSAGE_LEN ];
665
665
onig_error_code_to_str (err_str , err_code , err_info );
666
- php_error_docref (NULL , E_WARNING , "%s: %s" , pattern , err_str );
666
+ zend_throw_error (NULL , "%s: %s" , pattern , err_str );
667
667
retval = NULL ;
668
668
}
669
669
return retval ;
@@ -709,7 +709,7 @@ static void *_php_mb_compile_regex(const char *pattern)
709
709
PCRE2_CASELESS , & errnum , & err_offset , php_pcre_cctx ()))) {
710
710
PCRE2_UCHAR err_str [128 ];
711
711
pcre2_get_error_message (errnum , err_str , sizeof (err_str ));
712
- php_error_docref (NULL , E_WARNING , "%s (offset=%zu): %s" , pattern , err_offset , err_str );
712
+ zend_throw_error (NULL , "%s (offset=%zu): %s" , pattern , err_offset , err_str );
713
713
}
714
714
return retval ;
715
715
}
@@ -723,7 +723,7 @@ static int _php_mb_match_regex(void *opaque, const char *str, size_t str_len)
723
723
pcre2_match_data * match_data = php_pcre_create_match_data (0 , opaque );
724
724
if (NULL == match_data ) {
725
725
pcre2_code_free (opaque );
726
- php_error_docref (NULL , E_WARNING , "Cannot allocate match data" );
726
+ zend_throw_error (NULL , "Cannot allocate match data" );
727
727
return FAILURE ;
728
728
}
729
729
res = pcre2_match (opaque , (PCRE2_SPTR )str , str_len , 0 , 0 , match_data , php_pcre_mctx ()) >= 0 ;
@@ -1683,8 +1683,8 @@ PHP_FUNCTION(mb_substitute_character)
1683
1683
MBSTRG (current_filter_illegal_mode ) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR ;
1684
1684
MBSTRG (current_filter_illegal_substchar ) = Z_LVAL_P (arg1 );
1685
1685
} else {
1686
- php_error_docref (NULL , E_WARNING , "Unknown character" );
1687
- RETURN_FALSE ;
1686
+ zend_throw_error (NULL , "Unknown character" );
1687
+ return ;
1688
1688
}
1689
1689
}
1690
1690
break ;
@@ -1694,8 +1694,8 @@ PHP_FUNCTION(mb_substitute_character)
1694
1694
MBSTRG (current_filter_illegal_mode ) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR ;
1695
1695
MBSTRG (current_filter_illegal_substchar ) = Z_LVAL_P (arg1 );
1696
1696
} else {
1697
- php_error_docref (NULL , E_WARNING , "Unknown character" );
1698
- RETURN_FALSE ;
1697
+ zend_throw_error (NULL , "Unknown character" );
1698
+ return ;
1699
1699
}
1700
1700
break ;
1701
1701
}
@@ -2744,7 +2744,7 @@ MBSTRING_API char *php_mb_convert_encoding_ex(const char *input, size_t length,
2744
2744
/* initialize converter */
2745
2745
convd = mbfl_buffer_converter_new (from_encoding , to_encoding , string .len );
2746
2746
if (convd == NULL ) {
2747
- php_error_docref (NULL , E_WARNING , "Unable to create character encoding converter" );
2747
+ zend_throw_error (NULL , "Unable to create character encoding converter" );
2748
2748
return NULL ;
2749
2749
}
2750
2750
@@ -2805,11 +2805,12 @@ MBSTRING_API char *php_mb_convert_encoding(const char *input, size_t length, con
2805
2805
string .len = length ;
2806
2806
from_encoding = mbfl_identify_encoding (& string , list , size , MBSTRG (strict_detection ));
2807
2807
if (!from_encoding ) {
2808
- php_error_docref (NULL , E_WARNING , "Unable to detect character encoding" );
2809
- from_encoding = & mbfl_encoding_pass ;
2808
+ zend_throw_error (NULL , "Unable to detect character encoding" );
2809
+ return NULL ;
2810
2810
}
2811
2811
} else {
2812
- php_error_docref (NULL , E_WARNING , "Illegal character encoding specified" );
2812
+ zend_throw_error (NULL , "Illegal character encoding specified" );
2813
+ return NULL ;
2813
2814
}
2814
2815
if (list != NULL ) {
2815
2816
efree ((void * )list );
@@ -2835,7 +2836,7 @@ MBSTRING_API HashTable *php_mb_convert_encoding_recursive(HashTable *input, cons
2835
2836
2836
2837
if (GC_IS_RECURSIVE (input )) {
2837
2838
GC_UNPROTECT_RECURSION (input );
2838
- php_error_docref (NULL , E_WARNING , "Cannot convert recursively referenced values" );
2839
+ zend_throw_error (NULL , "Cannot convert recursively referenced values" );
2839
2840
return NULL ;
2840
2841
}
2841
2842
GC_TRY_PROTECT_RECURSION (input );
@@ -3570,14 +3571,14 @@ PHP_FUNCTION(mb_convert_variables)
3570
3571
if (elist != NULL ) {
3571
3572
efree ((void * )elist );
3572
3573
}
3573
- php_error_docref (NULL , E_WARNING , "Cannot handle recursive references" );
3574
- RETURN_FALSE ;
3574
+ zend_throw_error (NULL , "Cannot handle recursive references" );
3575
+ return ;
3575
3576
}
3576
3577
}
3577
3578
3578
3579
if (!from_encoding ) {
3579
- php_error_docref (NULL , E_WARNING , "Unable to detect encoding" );
3580
- from_encoding = & mbfl_encoding_pass ;
3580
+ zend_throw_error (NULL , "Unable to detect encoding" );
3581
+ return ;
3581
3582
}
3582
3583
}
3583
3584
if (elist != NULL ) {
@@ -3588,8 +3589,8 @@ PHP_FUNCTION(mb_convert_variables)
3588
3589
if (from_encoding != & mbfl_encoding_pass ) {
3589
3590
convd = mbfl_buffer_converter_new (from_encoding , to_encoding , 0 );
3590
3591
if (convd == NULL ) {
3591
- php_error_docref (NULL , E_WARNING , "Unable to create converter" );
3592
- RETURN_FALSE ;
3592
+ zend_throw_error (NULL , "Unable to create converter" );
3593
+ return ;
3593
3594
}
3594
3595
mbfl_buffer_converter_illegal_mode (convd , MBSTRG (current_filter_illegal_mode ));
3595
3596
mbfl_buffer_converter_illegal_substchar (convd , MBSTRG (current_filter_illegal_substchar ));
@@ -3613,8 +3614,8 @@ PHP_FUNCTION(mb_convert_variables)
3613
3614
mbfl_buffer_converter_delete (convd );
3614
3615
3615
3616
if (recursion_error ) {
3616
- php_error_docref (NULL , E_WARNING , "Cannot handle recursive references" );
3617
- RETURN_FALSE ;
3617
+ zend_throw_error (NULL , "Cannot handle recursive references" );
3618
+ return ;
3618
3619
}
3619
3620
}
3620
3621
@@ -4006,8 +4007,8 @@ PHP_FUNCTION(mb_send_mail)
4006
4007
}
4007
4008
4008
4009
if (!_tran_cs ) {
4009
- php_error_docref (NULL , E_WARNING , "Unsupported charset \"%s\" - will be regarded as ascii" , charset );
4010
- _tran_cs = & mbfl_encoding_ascii ;
4010
+ zend_throw_error (NULL , "Unsupported charset \"%s\" - will be regarded as ascii" , charset );
4011
+ return ;
4011
4012
}
4012
4013
tran_cs = _tran_cs ;
4013
4014
}
@@ -4030,9 +4031,8 @@ PHP_FUNCTION(mb_send_mail)
4030
4031
break ;
4031
4032
4032
4033
default :
4033
- php_error_docref (NULL , E_WARNING , "Unsupported transfer encoding \"%s\" - will be regarded as 8bit" , Z_STRVAL_P (s ));
4034
- body_enc = & mbfl_encoding_8bit ;
4035
- break ;
4034
+ zend_throw_error (NULL , "Unsupported transfer encoding \"%s\" - will be regarded as 8bit" , Z_STRVAL_P (s ));
4035
+ return ;
4036
4036
}
4037
4037
suppressed_hdrs .cnt_trans_enc = 1 ;
4038
4038
}
@@ -4391,7 +4391,7 @@ MBSTRING_API int php_mb_check_encoding(const char *input, size_t length, const c
4391
4391
4392
4392
convd = php_mb_init_convd (encoding );
4393
4393
if (convd == NULL ) {
4394
- php_error_docref (NULL , E_WARNING , "Unable to create converter" );
4394
+ zend_throw_error (NULL , "Unable to create converter" );
4395
4395
return 0 ;
4396
4396
}
4397
4397
@@ -4425,13 +4425,13 @@ MBSTRING_API int php_mb_check_encoding_recursive(HashTable *vars, const zend_str
4425
4425
4426
4426
convd = php_mb_init_convd (encoding );
4427
4427
if (convd == NULL ) {
4428
- php_error_docref (NULL , E_WARNING , "Unable to create converter" );
4428
+ zend_throw_error (NULL , "Unable to create converter" );
4429
4429
return 0 ;
4430
4430
}
4431
4431
4432
4432
if (GC_IS_RECURSIVE (vars )) {
4433
4433
mbfl_buffer_converter_delete (convd );
4434
- php_error_docref (NULL , E_WARNING , "Cannot not handle circular references" );
4434
+ zend_throw_error (NULL , "Cannot not handle circular references" );
4435
4435
return 0 ;
4436
4436
}
4437
4437
GC_TRY_PROTECT_RECURSION (vars );
@@ -4541,7 +4541,7 @@ static inline zend_long php_mb_ord(const char *str, size_t str_len, zend_string
4541
4541
enc , & mbfl_encoding_wchar ,
4542
4542
mbfl_wchar_device_output , 0 , & dev );
4543
4543
if (!filter ) {
4544
- php_error_docref (NULL , E_WARNING , "Creation of filter failed" );
4544
+ zend_throw_error (NULL , "Creation of filter failed" );
4545
4545
return -1 ;
4546
4546
}
4547
4547
0 commit comments