@@ -761,7 +761,7 @@ static PHP_INI_MH(OnUpdate_mbstring_http_input)
761761 php_error_docref ("ref.mbstring" , E_DEPRECATED , "Use of mbstring.http_input is deprecated" );
762762 }
763763
764- if (!new_value || !ZSTR_VAL (new_value )) {
764+ if (!new_value || !ZSTR_LEN (new_value )) {
765765 const char * encoding = php_get_input_encoding ();
766766 MBSTRG (http_input_set ) = 0 ;
767767 _php_mb_ini_mbstring_http_input_set (encoding , strlen (encoding ));
@@ -2617,15 +2617,27 @@ MBSTRING_API HashTable *php_mb_convert_encoding_recursive(HashTable *input, cons
26172617 ZEND_HASH_FOREACH_KEY_VAL (input , idx , key , entry ) {
26182618 /* convert key */
26192619 if (key ) {
2620- key = php_mb_convert_encoding (ZSTR_VAL (key ), ZSTR_LEN (key ), to_encoding , from_encodings , num_from_encodings );
2620+ zend_string * converted_key = php_mb_convert_encoding (ZSTR_VAL (key ), ZSTR_LEN (key ), to_encoding , from_encodings , num_from_encodings );
2621+ if (!converted_key ) {
2622+ continue ;
2623+ }
2624+ key = converted_key ;
26212625 }
26222626 /* convert value */
26232627 ZEND_ASSERT (entry );
26242628try_again :
26252629 switch (Z_TYPE_P (entry )) {
2626- case IS_STRING :
2627- ZVAL_STR (& entry_tmp , php_mb_convert_encoding (Z_STRVAL_P (entry ), Z_STRLEN_P (entry ), to_encoding , from_encodings , num_from_encodings ));
2630+ case IS_STRING : {
2631+ zend_string * converted_key = php_mb_convert_encoding (Z_STRVAL_P (entry ), Z_STRLEN_P (entry ), to_encoding , from_encodings , num_from_encodings );
2632+ if (!converted_key ) {
2633+ if (key ) {
2634+ zend_string_release (key );
2635+ }
2636+ continue ;
2637+ }
2638+ ZVAL_STR (& entry_tmp , converted_key );
26282639 break ;
2640+ }
26292641 case IS_NULL :
26302642 case IS_TRUE :
26312643 case IS_FALSE :
0 commit comments