79#define ILLEGAL_COOKIE_CHARACTER "\",\", \";\", \" \", \"\\t\", \"\\r\", \"\\n\", \"\\013\", or \"\\014\""
97 if (!url_encode &&
value &&
113#ifdef ZEND_ENABLE_ZVAL_LONG64
114 if (expires >= 253402300800) {
115 zend_value_error(
"%s(): \"expires\" option cannot have a year greater than 9999",
129 dt =
php_format_date(
"D, d M Y H:i:s \\G\\M\\T",
sizeof(
"D, d M Y H:i:s \\G\\M\\T")-1, 1, 0);
130 smart_str_appends(&
buf,
"Set-Cookie: ");
132 smart_str_appends(&
buf,
"=deleted; expires=");
133 smart_str_append(&
buf, dt);
134 smart_str_appends(&
buf,
"; Max-Age=0");
135 zend_string_free(dt);
137 smart_str_appends(&
buf,
"Set-Cookie: ");
139 smart_str_appendc(&
buf,
'=');
142 smart_str_append(&
buf, encoded_value);
152 dt =
php_format_date(
"D, d M Y H:i:s \\G\\M\\T",
sizeof(
"D, d M Y H:i:s \\G\\M\\T")-1, expires, 0);
154 smart_str_append(&
buf, dt);
155 zend_string_free(dt);
157 diff = difftime(expires,
php_time());
169 smart_str_append(&
buf, path);
173 smart_str_append(&
buf, domain);
181 if (samesite &&
ZSTR_LEN(samesite)) {
183 smart_str_append(&
buf, samesite);
190 zend_string_release(
buf.s);
206 *expires = zval_get_long(
value);
208 *path = zval_get_string(
value);
210 *domain = zval_get_string(
value);
216 *samesite = zval_get_string(
value);
230 bool secure = 0, httponly = 0;
250 if (
FAILURE == php_head_parse_cookie_options_array(
options, &expires, &path,
251 &domain, &secure, &httponly, &samesite)
266 zend_string_release(path);
269 zend_string_release(domain);
272 zend_string_release(samesite);
335static void php_head_apply_header_list_to_hash(
void *
data,
void *
arg)
339 if (
arg && sapi_header) {
380 old_response_code =
SG(sapi_headers).http_response_code;
381 SG(sapi_headers).http_response_code = (int)response_code;
383 if (old_response_code) {
SAPI_API int sapi_send_headers(void)
SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg)
http_response_code(int $response_code=0)
file(string $filename, int $flags=0, $context=null)
header_remove(?string $name=null)
setrawcookie(string $name, string $value="", array|int $expires_or_options=0, string $path="", string $domain="", bool $secure=false, bool $httponly=false)
strpbrk(string $string, string $characters)
header(string $header, bool $replace=true, int $response_code=0)
setcookie(string $name, string $value="", array|int $expires_or_options=0, string $path="", string $domain="", bool $secure=false, bool $httponly=false)
headers_sent(&$filename=null, &$line=null)
zend_ffi_ctype_name_buf buf
PHPAPI zend_result php_setcookie(zend_string *name, zend_string *value, time_t expires, zend_string *path, zend_string *domain, bool secure, bool httponly, zend_string *samesite, bool url_encode)
#define ILLEGAL_COOKIE_CHARACTER
PHPAPI bool php_header(void)
foreach($dp as $el) foreach( $dp as $el) if( $pass2< 2) echo ""
PHPAPI ZEND_COLD void php_error_docref(const char *docref, int type, const char *format,...)
PHPAPI const char * php_output_get_start_filename(void)
PHPAPI int php_output_get_start_lineno(void)
PHPAPI zend_string * php_format_date(const char *format, size_t format_len, time_t ts, bool localtime)
PHPAPI time_t php_time(void)
PHP_JSON_API size_t int options
zend_string * output_start_filename
unsigned char key[REFLECTION_KEY_LEN]
PHPAPI zend_string * php_raw_url_encode(char const *s, size_t len)
ZEND_API ZEND_COLD void zend_argument_count_error(const char *format,...)
ZEND_API ZEND_COLD void zend_value_error(const char *format,...)
#define INTERNAL_FUNCTION_PARAMETERS
#define INTERNAL_FUNCTION_PARAM_PASSTHRU
ZEND_API ZEND_COLD void zend_argument_must_not_be_empty_error(uint32_t arg_num)
ZEND_API ZEND_COLD void zend_argument_value_error(uint32_t arg_num, const char *format,...)
ZEND_API zend_result add_next_index_string(zval *arg, const char *str)
#define ZEND_PARSE_PARAMETERS_END()
#define ZEND_PARSE_PARAMETERS_NONE()
#define Z_PARAM_STRING(dest, dest_len)
#define Z_PARAM_STR(dest)
#define Z_PARAM_STRING_OR_NULL(dest, dest_len)
#define ZEND_PARSE_PARAMETERS_START(min_num_args, max_num_args)
#define ZEND_TRY_ASSIGN_REF_LONG(zv, lval)
#define Z_PARAM_LONG(dest)
#define ZEND_TRY_ASSIGN_REF_EMPTY_STRING(zv)
#define Z_PARAM_BOOL(dest)
#define Z_PARAM_ZVAL(dest)
#define ZEND_TRY_ASSIGN_REF_STRING(zv, string)
#define Z_PARAM_ARRAY_HT_OR_LONG(dest_ht, dest_long)
zend_string_release_ex(func->internal_function.function_name, 0)
ZEND_API const char * get_active_function_name(void)
#define ZEND_HASH_FOREACH_STR_KEY_VAL(ht, _key, _val)
#define ZEND_HASH_FOREACH_END()
ZEND_API void zend_llist_apply_with_argument(zend_llist *l, llist_apply_with_arg_func_t func, void *arg)
struct _zend_string zend_string
#define UNEXPECTED(condition)
#define zend_string_equals_literal_ci(str, c)
struct _zend_array HashTable
ZEND_RESULT_CODE zend_result