codeguy/Slim — pull request #606 by jeremykendall (2013-09-01 16:09:09+00:00)
Title: Fixes flash messaging/SessionCookie decoding failure when cookies.encrypt = true

Without a way to check if a cookie is already encoded,
`\Slim\Http\Util::serializeCookies()` will encode an already encoded
cookie. This is an issue when `\Slim\Middleware\SessionCookie` sets an
encoded cookie value on the response object during
`\Slim\Middleware\SessionCookie::saveSession()`
(as `\Slim\Http\Util::serializeCookies()` will encode every cookie it gets if
`cookies.encrypt` = `true`). Since the cookie is only decoded once
during `\Slim\Middleware\SessionCookie::loadSession()`, the cookie's
actual decoded value is never available to the application, and
`unserialize()` in `\Slim\Middleware\SessionCookie::loadSession()` will
fail.

This PR adds the ability to tell `\Slim\Http\Util::serializeCookies()` to
skip encoding a cookie during the serialization process.