@@ -408,11 +408,11 @@ static void php_zval_filter(zval *value, zend_long filter, zend_long flags, zval
408
408
filter_func .function (value , flags , options , charset );
409
409
410
410
handle_default :
411
- if (options && ( Z_TYPE_P (options ) == IS_ARRAY || Z_TYPE_P ( options ) == IS_OBJECT ) &&
411
+ if (options && Z_TYPE_P (options ) == IS_ARRAY &&
412
412
((flags & FILTER_NULL_ON_FAILURE && Z_TYPE_P (value ) == IS_NULL ) ||
413
413
(!(flags & FILTER_NULL_ON_FAILURE ) && Z_TYPE_P (value ) == IS_FALSE ))) {
414
414
zval * tmp ;
415
- if ((tmp = zend_hash_str_find (HASH_OF (options ), "default" , sizeof ("default" ) - 1 )) != NULL ) {
415
+ if ((tmp = zend_hash_str_find (Z_ARRVAL_P (options ), "default" , sizeof ("default" ) - 1 )) != NULL ) {
416
416
ZVAL_COPY (value , tmp );
417
417
}
418
418
}
@@ -613,22 +613,19 @@ static void php_filter_call(zval *filtered, zend_long filter, zval *filter_args,
613
613
filter = lval ;
614
614
}
615
615
} else if (filter_args ) {
616
- if ((option = zend_hash_str_find (HASH_OF (filter_args ), "filter" , sizeof ("filter" ) - 1 )) != NULL ) {
616
+ if ((option = zend_hash_str_find (Z_ARRVAL_P (filter_args ), "filter" , sizeof ("filter" ) - 1 )) != NULL ) {
617
617
filter = zval_get_long (option );
618
618
}
619
619
620
- if ((option = zend_hash_str_find (HASH_OF (filter_args ), "flags" , sizeof ("flags" ) - 1 )) != NULL ) {
620
+ if ((option = zend_hash_str_find (Z_ARRVAL_P (filter_args ), "flags" , sizeof ("flags" ) - 1 )) != NULL ) {
621
621
filter_flags = zval_get_long (option );
622
622
623
623
if (!(filter_flags & FILTER_REQUIRE_ARRAY || filter_flags & FILTER_FORCE_ARRAY )) {
624
624
filter_flags |= FILTER_REQUIRE_SCALAR ;
625
625
}
626
626
}
627
627
628
- if ((option = zend_hash_str_find (HASH_OF (filter_args ), "options" , sizeof ("options" ) - 1 )) != NULL ) {
629
- /* avoid reference type */
630
- ZVAL_DEREF (option );
631
-
628
+ if ((option = zend_hash_str_find_deref (Z_ARRVAL_P (filter_args ), "options" , sizeof ("options" ) - 1 )) != NULL ) {
632
629
if (filter != FILTER_CALLBACK ) {
633
630
if (Z_TYPE_P (option ) == IS_ARRAY ) {
634
631
options = option ;
@@ -744,13 +741,13 @@ PHP_FUNCTION(filter_input)
744
741
if (filter_args ) {
745
742
if (Z_TYPE_P (filter_args ) == IS_LONG ) {
746
743
filter_flags = Z_LVAL_P (filter_args );
747
- } else if (Z_TYPE_P (filter_args ) == IS_ARRAY && (option = zend_hash_str_find (HASH_OF (filter_args ), "flags" , sizeof ("flags" ) - 1 )) != NULL ) {
744
+ } else if (Z_TYPE_P (filter_args ) == IS_ARRAY && (option = zend_hash_str_find (Z_ARRVAL_P (filter_args ), "flags" , sizeof ("flags" ) - 1 )) != NULL ) {
748
745
filter_flags = zval_get_long (option );
749
746
}
750
747
if (Z_TYPE_P (filter_args ) == IS_ARRAY &&
751
- (opt = zend_hash_str_find ( HASH_OF (filter_args ), "options" , sizeof ("options" ) - 1 )) != NULL &&
748
+ (opt = zend_hash_str_find_deref ( Z_ARRVAL_P (filter_args ), "options" , sizeof ("options" ) - 1 )) != NULL &&
752
749
Z_TYPE_P (opt ) == IS_ARRAY &&
753
- (def = zend_hash_str_find ( HASH_OF (opt ), "default" , sizeof ("default" ) - 1 )) != NULL ) {
750
+ (def = zend_hash_str_find_deref ( Z_ARRVAL_P (opt ), "default" , sizeof ("default" ) - 1 )) != NULL ) {
754
751
ZVAL_COPY (return_value , def );
755
752
return ;
756
753
}
@@ -821,7 +818,7 @@ PHP_FUNCTION(filter_input_array)
821
818
if (op ) {
822
819
if (Z_TYPE_P (op ) == IS_LONG ) {
823
820
filter_flags = Z_LVAL_P (op );
824
- } else if (Z_TYPE_P (op ) == IS_ARRAY && (option = zend_hash_str_find (HASH_OF (op ), "flags" , sizeof ("flags" ) - 1 )) != NULL ) {
821
+ } else if (Z_TYPE_P (op ) == IS_ARRAY && (option = zend_hash_str_find (Z_ARRVAL_P (op ), "flags" , sizeof ("flags" ) - 1 )) != NULL ) {
825
822
filter_flags = zval_get_long (option );
826
823
}
827
824
}
0 commit comments