Skip to content

Commit

Permalink
Rewriting HttpSocket::parseCookies() to not use a negative lookbehind…
Browse files Browse the repository at this point in the history
… regex, due to a bug in PCRE engine in PHP 5.1.x. Fixes #6533.

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8269 3807eeeb-6ff5-0310-8944-8be069107fe0
  • Loading branch information
jperras committed Aug 1, 2009
1 parent 5172035 commit 12e4db0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cake/libs/http_socket.php
Expand Up @@ -852,9 +852,16 @@ function parseCookies($header) {

$cookies = array();
foreach ((array)$header['Set-Cookie'] as $cookie) {
$parts = preg_split('/(?<![^;]");[ \t]*/', $cookie);
if (strpos($cookie, '";"') !== false) {
$cookie = str_replace('";"', "{__cookie_replace__}", $cookie);
$parts = str_replace("{__cookie_replace__}", '";"', preg_split('/\;/', $cookie));
} else {
$parts = preg_split('/\;[ \t]*/', $cookie);
}

list($name, $value) = explode('=', array_shift($parts), 2);
$cookies[$name] = compact('value');

foreach ($parts as $part) {
if (strpos($part, '=') !== false) {
list($key, $value) = explode('=', $part);
Expand Down

0 comments on commit 12e4db0

Please sign in to comment.