note 26380 rejected from function.setcookie by betz

From: Date: Tue, 29 Oct 2002 09:46:33 +0000
Subject: note 26380 rejected from function.setcookie by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-38687@lists.php.net to get a copy of this message
Something to note, if you have quotes in the cookie value you set, they will be back-slashed in $_COOKIE[]. E.g.: setcookie('dialog', 'He said, "Hello."'); Then later $_COOKIE['dialog'] will have: He said, \"Hello.\" This will definately cause trouble if you're trying to serialize() and unserialize() data into a cookie. I use stripslashes() on the $_COOKIE value, though can't be certain it will handle all cases, but works so far for me. I found this behavior on both Mozilla and IE, so I don't believe it's the browser adding the back-slashes.

« previous php.notes (#38687) next »