Rewriting HttpSocket::parseCookies() to not use a negative lookbehind 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
This commit is contained in:
jperras 2009-08-01 23:38:26 +00:00
parent 5172035e02
commit 12e4db0810

View file

@ -852,9 +852,16 @@ class HttpSocket extends CakeSocket {
$cookies = array(); $cookies = array();
foreach ((array)$header['Set-Cookie'] as $cookie) { 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); list($name, $value) = explode('=', array_shift($parts), 2);
$cookies[$name] = compact('value'); $cookies[$name] = compact('value');
foreach ($parts as $part) { foreach ($parts as $part) {
if (strpos($part, '=') !== false) { if (strpos($part, '=') !== false) {
list($key, $value) = explode('=', $part); list($key, $value) = explode('=', $part);