Skip to content

Commit 32d7e08

Browse files
committed
Remove some redundant uses of HASH_OF
GET etc are always arrays, they cannot be objects. We just need to check that they are initialized.
1 parent a8bc388 commit 32d7e08

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

ext/filter/filter.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,11 @@ static zval *php_filter_get_storage(zend_long arg)/* {{{ */
561561
break;
562562
}
563563

564+
if (array_ptr && Z_TYPE_P(array_ptr) != IS_ARRAY) {
565+
/* Storage not initialized */
566+
return NULL;
567+
}
568+
564569
return array_ptr;
565570
}
566571
/* }}} */
@@ -580,7 +585,7 @@ PHP_FUNCTION(filter_has_var)
580585

581586
array_ptr = php_filter_get_storage(arg);
582587

583-
if (array_ptr && HASH_OF(array_ptr) && zend_hash_exists(HASH_OF(array_ptr), var)) {
588+
if (array_ptr && zend_hash_exists(Z_ARRVAL_P(array_ptr), var)) {
584589
RETURN_TRUE;
585590
}
586591

@@ -733,7 +738,7 @@ PHP_FUNCTION(filter_input)
733738

734739
input = php_filter_get_storage(fetch_from);
735740

736-
if (!input || !HASH_OF(input) || (tmp = zend_hash_find(HASH_OF(input), var)) == NULL) {
741+
if (!input || (tmp = zend_hash_find(Z_ARRVAL_P(input), var)) == NULL) {
737742
zend_long filter_flags = 0;
738743
zval *option, *opt, *def;
739744
if (filter_args) {
@@ -810,7 +815,7 @@ PHP_FUNCTION(filter_input_array)
810815

811816
array_input = php_filter_get_storage(fetch_from);
812817

813-
if (!array_input || !HASH_OF(array_input)) {
818+
if (!array_input) {
814819
zend_long filter_flags = 0;
815820
zval *option;
816821
if (op) {

0 commit comments

Comments
 (0)