@@ -396,36 +396,42 @@ static php_stream_filter *php_bz2_decompress_filter_create(zval *filter_params,
396396 bool expect_concatenated = false;
397397
398398 if (filter_params ) {
399- if (Z_TYPE_P (filter_params ) == IS_TRUE || Z_TYPE_P (filter_params ) == IS_FALSE ) {
400- small_footprint = Z_TYPE_P (filter_params ) == IS_TRUE ;
401- goto allocate_decompress_filter ;
402- }
403- if (UNEXPECTED (Z_TYPE_P (filter_params ) != IS_ARRAY && Z_TYPE_P (filter_params ) != IS_OBJECT )) {
399+ if (UNEXPECTED (
400+ Z_TYPE_P (filter_params ) != IS_TRUE
401+ && Z_TYPE_P (filter_params ) != IS_FALSE
402+ && Z_TYPE_P (filter_params ) != IS_ARRAY
403+ && Z_TYPE_P (filter_params ) != IS_OBJECT
404+ )) {
404405 php_error_docref (NULL , E_WARNING ,
405- "Filter parameters for bzip2.decompress filter must be of type array|bool, %s given" ,
406+ "Filter parameters for bzip2.decompress filter must be of type array|object| bool, %s given" ,
406407 zend_zval_type_name (filter_params )
407408 );
408409 return NULL ;
409410 }
410411
411- const HashTable * filter_params_ht = HASH_OF (filter_params );
412- /* TODO: convert php_stream_filter_parse_write_seek_mode() to take HashTable */
413- if (php_stream_filter_parse_write_seek_mode (filter_params , & write_seekable ) == FAILURE ) {
414- return NULL ;
415- }
412+ if (Z_TYPE_P (filter_params ) == IS_TRUE || Z_TYPE_P (filter_params ) == IS_FALSE ) {
413+ small_footprint = Z_TYPE_P (filter_params ) == IS_TRUE ;
414+ } else {
415+ ZEND_ASSERT (Z_TYPE_P (filter_params ) == IS_ARRAY || Z_TYPE_P (filter_params ) == IS_OBJECT );
416416
417- const zval * concatenated = zend_hash_str_find_ind (filter_params_ht , ZEND_STRL ("concatenated" ));
418- if (concatenated ) {
419- expect_concatenated = zend_is_true (concatenated );
420- }
417+ const HashTable * filter_params_ht = HASH_OF (filter_params );
418+ /* TODO: convert php_stream_filter_parse_write_seek_mode() to take HashTable */
419+ if (php_stream_filter_parse_write_seek_mode (filter_params , & write_seekable ) == FAILURE ) {
420+ return NULL ;
421+ }
422+
423+ const zval * concatenated = zend_hash_str_find_ind (filter_params_ht , ZEND_STRL ("concatenated" ));
424+ if (concatenated ) {
425+ expect_concatenated = zend_is_true (concatenated );
426+ }
421427
422- const zval * small = zend_hash_str_find_ind (filter_params_ht , ZEND_STRL ("small" ));
423- if (small ) {
424- small_footprint = zend_is_true (small );
428+ const zval * small = zend_hash_str_find_ind (filter_params_ht , ZEND_STRL ("small" ));
429+ if (small ) {
430+ small_footprint = zend_is_true (small );
431+ }
425432 }
426433 }
427434
428- allocate_decompress_filter :;
429435 php_bz2_filter_data * data = php_bz2_filter_data_new (persistent );
430436 /* Save configuration for reset */
431437 data -> small_footprint = small_footprint ;
@@ -443,7 +449,7 @@ static php_stream_filter *php_bz2_compress_filter_create(zval *filter_params, bo
443449 if (filter_params ) {
444450 if (UNEXPECTED (Z_TYPE_P (filter_params ) != IS_ARRAY && Z_TYPE_P (filter_params ) != IS_OBJECT )) {
445451 php_error_docref (NULL , E_WARNING ,
446- "Filter parameters for bzip2.compress filter must be of type array, %s given" ,
452+ "Filter parameters for bzip2.compress filter must be of type array|object , %s given" ,
447453 zend_zval_type_name (filter_params )
448454 );
449455 return NULL ;
0 commit comments