From: Michael Wallner Date: Fri, 9 Dec 2005 16:18:07 +0000 (+0000) Subject: - proper type checking, thanks Sara X-Git-Tag: RELEASE_0_20_0~39 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=d4738dfa25feeba82269ac47f7f4b3054da7fe42;p=m6w6%2Fext-http - proper type checking, thanks Sara --- diff --git a/http_api.c b/http_api.c index 0bb6cf2..6f6c5d6 100644 --- a/http_api.c +++ b/http_api.c @@ -296,10 +296,10 @@ PHP_HTTP_API zval *_http_get_server_var_ex(const char *key, size_t key_size, zen zval **hsv; zval **var; - if (SUCCESS != zend_hash_find(&EG(symbol_table), "_SERVER", sizeof("_SERVER"), (void **) &hsv)) { + if ((SUCCESS != zend_hash_find(&EG(symbol_table), "_SERVER", sizeof("_SERVER"), (void **) &hsv)) || (Z_TYPE_PP(hsv) != IS_ARRAY)) { return NULL; } - if (SUCCESS != zend_hash_find(Z_ARRVAL_PP(hsv), (char *) key, key_size, (void **) &var)) { + if ((SUCCESS != zend_hash_find(Z_ARRVAL_PP(hsv), (char *) key, key_size, (void **) &var)) || (Z_TYPE_PP(var) != IS_STRING)) { return NULL; } if (check && !(Z_STRVAL_PP(var) && Z_STRLEN_PP(var))) {