From d4738dfa25feeba82269ac47f7f4b3054da7fe42 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Fri, 9 Dec 2005 16:18:07 +0000 Subject: [PATCH] - proper type checking, thanks Sara --- http_api.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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))) { -- 2.30.2