mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 11:06:15 +00:00
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:
parent
5172035e02
commit
12e4db0810
1 changed files with 8 additions and 1 deletions
|
@ -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);
|
||||||
|
|
Loading…
Add table
Reference in a new issue