Skip to content

Commit

Permalink
Fix setcookie arguments for PHP 5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
m92o authored and Josh Lockhart committed Feb 5, 2012
1 parent e3d59c1 commit 4810fd5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Slim/Http/Response.php
Expand Up @@ -294,7 +294,12 @@ protected function sendHeaders() {

//Send cookies
foreach ( $this->getCookieJar()->getResponseCookies() as $name => $cookie ) {
setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpires(), $cookie->getPath(), $cookie->getDomain(), $cookie->getSecure(), $cookie->getHttpOnly());
/* httponly option is only available for PHP version >= 5.2 */
if ( version_compare(PHP_VERSION, '5.2.0', '>=') ) {
setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpires(), $cookie->getPath(), $cookie->getDomain(), $cookie->getSecure(), $cookie->getHttpOnly());
} else {
setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpires(), $cookie->getPath(), $cookie->getDomain(), $cookie->getSecure());
}
}

//Flush all output to client
Expand Down

0 comments on commit 4810fd5

Please sign in to comment.