static int phalcon_session_adapter_has_property_internal(zval *object, zval *member, int has_set_exists TSRMLS_DC) { zval *unique_id, *_SESSION, **tmp; zval key = zval_used_for_init, *pkey = &key; unique_id = phalcon_fetch_nproperty_this(object, SL("_uniqueId"), PH_NOISY TSRMLS_CC); _SESSION = phalcon_get_global(SS("_SESSION") TSRMLS_CC); if (Z_TYPE_P(_SESSION) != IS_ARRAY) { return 0; } phalcon_concat_vv(&pkey, unique_id, member, 0 TSRMLS_CC); tmp = phalcon_hash_get(Z_ARRVAL_P(_SESSION), pkey, BP_VAR_NA); zval_dtor(&key); if (!tmp) { return 0; } if (0 == has_set_exists) { return Z_TYPE_PP(tmp) != IS_NULL; } if (1 == has_set_exists) { return zend_is_true(*tmp); } return 1; }
/** * Gets query string which request has been made * * @return string */ PHP_METHOD(Phalcon_Http_Request, getQueryString){ zval *value, *_SERVER, key = {}; PHALCON_STR(&key, "QUERY_STRING"); _SERVER = phalcon_get_global_str(SS("_SERVER") TSRMLS_CC); value = (Z_TYPE_P(_SERVER) == IS_ARRAY) ? phalcon_hash_get(Z_ARRVAL_P(_SERVER), &key, BP_VAR_UNSET) : NULL; if (value && Z_TYPE_P(value) == IS_STRING) { RETURN_ZVAL(value, 1, 0); } RETURN_EMPTY_STRING(); }
/** * Gets HTTP URI which request has been made * * @return string */ PHP_METHOD(Phalcon_Http_Request, getURI){ zval *value, *_SERVER, key = {}; PHALCON_STR(&key, "REQUEST_URI"); _SERVER = phalcon_get_global_str(SL("_SERVER")); value = (Z_TYPE_P(_SERVER) == IS_ARRAY) ? phalcon_hash_get(Z_ARRVAL_P(_SERVER), &key, BP_VAR_UNSET) : NULL; if (value && Z_TYPE_P(value) == IS_STRING) { RETURN_ZVAL(value, 1, 0); } RETURN_EMPTY_STRING(); }
static const char* phalcon_http_request_getmethod_helper() { zval *value, *_SERVER, key = {}; const char *method = SG(request_info).request_method; if (unlikely(!method)) { PHALCON_STR(&key, "REQUEST_METHOD"); _SERVER = phalcon_get_global_str(SL("_SERVER")); if (Z_TYPE_P(_SERVER) == IS_ARRAY) { value = phalcon_hash_get(Z_ARRVAL_P(_SERVER), &key, BP_VAR_UNSET); if (value && Z_TYPE_P(value) == IS_STRING) { return Z_STRVAL_P(value); } } return ""; } return method; }
static const char* phalcon_http_request_getmethod_helper(TSRMLS_D) { zval **value; const char *method = SG(request_info).request_method; if (unlikely(!method)) { zval *_SERVER, key; INIT_ZVAL(key); ZVAL_STRING(&key, "REQUEST_METHOD", 0); phalcon_get_global(&_SERVER, SS("_SERVER") TSRMLS_CC); value = phalcon_hash_get(Z_ARRVAL_P(_SERVER), &key, BP_VAR_NA); if (value && Z_TYPE_PP(value) == IS_STRING) { return Z_STRVAL_PP(value); } return ""; } return method; }
static zval* phalcon_forms_manager_read_dimension(zval *object, zval *offset, int type, zval *rv) { zval *forms, *res, tmp = {}; if (UNEXPECTED(!offset)) { return &EG(uninitialized_zval); } forms = phalcon_read_property(object, SL("_forms"), PH_NOISY); if (UNEXPECTED(Z_TYPE_P(forms)) != IS_ARRAY) { return &EG(uninitialized_zval); } if (type == BP_VAR_RW) { type = BP_VAR_R; } else if (type == BP_VAR_W) { type = BP_VAR_IS; } res = phalcon_hash_get(Z_ARRVAL_P(forms), offset, type); if (!res || res == &EG(uninitialized_zval)) { if (UNEXPECTED(Z_TYPE_P(offset) != IS_STRING)) { ZVAL_ZVAL(&tmp, offset, 1, 0); convert_to_string(&tmp); offset = &tmp; } zend_throw_exception_ex(phalcon_forms_exception_ce, 0, "There is no form with name='%s'", Z_STRVAL_P(offset)); if (UNEXPECTED(offset == &tmp)) { zval_dtor(&tmp); } return NULL; } return res; }