summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2018-10-11 12:01:18 +0200
committerNikita Popov <nikita.ppv@gmail.com>2018-10-11 12:01:18 +0200
commit32d7e08286be3f7a1d8529d306a8cecebde8555c (patch)
treee21864554c8be9cb6970b228191bbf4d5eb3f8ad /ext
parenta8bc3889fd07fb4897d1e2b7f2d2b15388d76e39 (diff)
downloadphp-git-32d7e08286be3f7a1d8529d306a8cecebde8555c.tar.gz
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.
Diffstat (limited to 'ext')
-rw-r--r--ext/filter/filter.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/ext/filter/filter.c b/ext/filter/filter.c
index 5b69024526..7e2cee4c9f 100644
--- a/ext/filter/filter.c
+++ b/ext/filter/filter.c
@@ -561,6 +561,11 @@ static zval *php_filter_get_storage(zend_long arg)/* {{{ */
break;
}
+ if (array_ptr && Z_TYPE_P(array_ptr) != IS_ARRAY) {
+ /* Storage not initialized */
+ return NULL;
+ }
+
return array_ptr;
}
/* }}} */
@@ -580,7 +585,7 @@ PHP_FUNCTION(filter_has_var)
array_ptr = php_filter_get_storage(arg);
- if (array_ptr && HASH_OF(array_ptr) && zend_hash_exists(HASH_OF(array_ptr), var)) {
+ if (array_ptr && zend_hash_exists(Z_ARRVAL_P(array_ptr), var)) {
RETURN_TRUE;
}
@@ -733,7 +738,7 @@ PHP_FUNCTION(filter_input)
input = php_filter_get_storage(fetch_from);
- if (!input || !HASH_OF(input) || (tmp = zend_hash_find(HASH_OF(input), var)) == NULL) {
+ if (!input || (tmp = zend_hash_find(Z_ARRVAL_P(input), var)) == NULL) {
zend_long filter_flags = 0;
zval *option, *opt, *def;
if (filter_args) {
@@ -810,7 +815,7 @@ PHP_FUNCTION(filter_input_array)
array_input = php_filter_get_storage(fetch_from);
- if (!array_input || !HASH_OF(array_input)) {
+ if (!array_input) {
zend_long filter_flags = 0;
zval *option;
if (op) {