@@ -2545,10 +2545,8 @@ MBSTRING_API char *php_mb_convert_encoding_ex(const char *input, size_t length,
2545
2545
2546
2546
/* initialize converter */
2547
2547
convd = mbfl_buffer_converter_new (from_encoding , to_encoding , string .len );
2548
- if (convd == NULL ) {
2549
- php_error_docref (NULL , E_WARNING , "Unable to create character encoding converter" );
2550
- return NULL ;
2551
- }
2548
+ /* If this assertion fails this means some memory allocation failure which is a bug */
2549
+ ZEND_ASSERT (convd != NULL );
2552
2550
2553
2551
mbfl_buffer_converter_illegal_mode (convd , MBSTRG (current_filter_illegal_mode ));
2554
2552
mbfl_buffer_converter_illegal_substchar (convd , MBSTRG (current_filter_illegal_substchar ));
@@ -3342,10 +3340,9 @@ PHP_FUNCTION(mb_convert_variables)
3342
3340
convd = NULL ;
3343
3341
if (from_encoding != & mbfl_encoding_pass ) {
3344
3342
convd = mbfl_buffer_converter_new (from_encoding , to_encoding , 0 );
3345
- if (convd == NULL ) {
3346
- php_error_docref (NULL , E_WARNING , "Unable to create converter" );
3347
- RETURN_FALSE ;
3348
- }
3343
+ /* If this assertion fails this means some memory allocation failure which is a bug */
3344
+ ZEND_ASSERT (convd != NULL );
3345
+
3349
3346
mbfl_buffer_converter_illegal_mode (convd , MBSTRG (current_filter_illegal_mode ));
3350
3347
mbfl_buffer_converter_illegal_substchar (convd , MBSTRG (current_filter_illegal_substchar ));
3351
3348
}
@@ -4127,10 +4124,8 @@ MBSTRING_API int php_mb_check_encoding(
4127
4124
mbfl_buffer_converter * convd ;
4128
4125
4129
4126
convd = php_mb_init_convd (encoding );
4130
- if (convd == NULL ) {
4131
- php_error_docref (NULL , E_WARNING , "Unable to create converter" );
4132
- return 0 ;
4133
- }
4127
+ /* If this assertion fails this means some memory allocation failure which is a bug */
4128
+ ZEND_ASSERT (convd != NULL );
4134
4129
4135
4130
if (php_mb_check_encoding_impl (convd , input , length , encoding )) {
4136
4131
mbfl_buffer_converter_delete (convd );
@@ -4151,10 +4146,8 @@ static int php_mb_check_encoding_recursive(HashTable *vars, const mbfl_encoding
4151
4146
(void )(idx );
4152
4147
4153
4148
convd = php_mb_init_convd (encoding );
4154
- if (convd == NULL ) {
4155
- php_error_docref (NULL , E_WARNING , "Unable to create converter" );
4156
- return 0 ;
4157
- }
4149
+ /* If this assertion fails this means some memory allocation failure which is a bug */
4150
+ ZEND_ASSERT (convd != NULL );
4158
4151
4159
4152
if (GC_IS_RECURSIVE (vars )) {
4160
4153
mbfl_buffer_converter_delete (convd );
@@ -4270,13 +4263,9 @@ static inline zend_long php_mb_ord(const char *str, size_t str_len, zend_string
4270
4263
zend_long cp ;
4271
4264
4272
4265
mbfl_wchar_device_init (& dev );
4273
- filter = mbfl_convert_filter_new (
4274
- enc , & mbfl_encoding_wchar ,
4275
- mbfl_wchar_device_output , 0 , & dev );
4276
- if (!filter ) {
4277
- php_error_docref (NULL , E_WARNING , "Creation of filter failed" );
4278
- return -1 ;
4279
- }
4266
+ filter = mbfl_convert_filter_new (enc , & mbfl_encoding_wchar , mbfl_wchar_device_output , 0 , & dev );
4267
+ /* If this assertion fails this means some memory allocation failure which is a bug */
4268
+ ZEND_ASSERT (filter != NULL );
4280
4269
4281
4270
mbfl_convert_filter_feed_string (filter , (const unsigned char * ) str , str_len );
4282
4271
mbfl_convert_filter_flush (filter );
0 commit comments