com php-src: Remove some redundant uses of HASH_OF: ext/f ilter/filter.c

From: Date: Thu, 11 Oct 2018 10:01:18 +0000
Subject: com php-src: Remove some redundant uses of HASH_OF: ext/f ilter/filter.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-103429@lists.php.net to get a copy of this message
Commit: 32d7e08286be3f7a1d8529d306a8cecebde8555c Author: Nikita Popov <nikita.ppv@gmail.com> Thu, 11 Oct 2018 12:01:18 +0200 Parents: a8bc3889fd07fb4897d1e2b7f2d2b15388d76e39 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=32d7e08286be3f7a1d8529d306a8cecebde8555c Log: 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. Changed paths: M ext/filter/filter.c Diff: diff --git a/ext/filter/filter.c b/ext/filter/filter.c index 5b69024..7e2cee4 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) {

« previous php.cvs (#103429) next »