summaryrefslogtreecommitdiff
path: root/ext/standard/head.c
diff options
context:
space:
mode:
authorRasmus Lerdorf <rasmus@php.net>2001-07-21 00:14:14 +0000
committerRasmus Lerdorf <rasmus@php.net>2001-07-21 00:14:14 +0000
commitbf513871bc85bf23e2de729966f77129defc251c (patch)
treeec1308eb8b1252604403ebf61de546b1a667c196 /ext/standard/head.c
parent6d4e4e0cf5399e47a6d277ff5eceec7e637462ba (diff)
downloadphp-git-bf513871bc85bf23e2de729966f77129defc251c.tar.gz
Fix more crashes related to this switch to z_value
Diffstat (limited to 'ext/standard/head.c')
-rw-r--r--ext/standard/head.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/standard/head.c b/ext/standard/head.c
index a269c97f02..cb0bba7128 100644
--- a/ext/standard/head.c
+++ b/ext/standard/head.c
@@ -132,7 +132,7 @@ PHP_FUNCTION(setcookie)
len += Z_STRLEN_PP(z_domain);
}
cookie = emalloc(len + 100);
- if (!Z_STRVAL_PP(z_value) || !Z_STRVAL_PP(z_value)[0]) {
+ if (z_value && (!Z_STRVAL_PP(z_value) || (Z_STRVAL_PP(z_value) && !Z_STRVAL_PP(z_value)[0]))) {
/*
* MSIE doesn't delete a cookie when you set it to a null value
* so in order to force cookies to be deleted, even on MSIE, we
@@ -144,7 +144,7 @@ PHP_FUNCTION(setcookie)
efree(dt);
} else {
/* FIXME: XXX: this is not binary data safe */
- sprintf(cookie, "Set-Cookie: %s=%s", Z_STRVAL_PP(z_name), Z_STRVAL_PP(z_value) ? encoded_value : "");
+ sprintf(cookie, "Set-Cookie: %s=%s", Z_STRVAL_PP(z_name), (z_value && Z_STRVAL_PP(z_value)) ? encoded_value : "");
if (expires > 0) {
strcat(cookie, "; expires=");
dt = php_std_date(expires);