1
0
mirror of https://github.com/guzzle/guzzle.git synced 2025-02-24 10:03:27 +01:00

Merge pull request #1406 from dvaeversted/noqoute-cookies

Do not attempt to escape cookie values.
This commit is contained in:
Michael Dowling 2016-02-17 13:09:10 -08:00
commit 739b9c8378
2 changed files with 2 additions and 22 deletions

View File

@ -58,22 +58,10 @@ class CookieJar implements CookieJarInterface
}
/**
* Quote the cookie value if it is not already quoted and it contains
* problematic characters.
*
* @param string $value Value that may or may not need to be quoted
*
* @return string
* @deprecated
*/
public static function getCookieValue($value)
{
if (substr($value, 0, 1) !== '"' &&
substr($value, -1, 1) !== '"' &&
strpbrk($value, ';,=')
) {
$value = '"' . $value . '"';
}
return $value;
}
@ -248,7 +236,7 @@ class CookieJar implements CookieJarInterface
(!$cookie->getSecure() || $scheme == 'https')
) {
$values[] = $cookie->getName() . '='
. self::getCookieValue($cookie->getValue());
. $cookie->getValue();
}
}

View File

@ -28,14 +28,6 @@ class CookieJarTest extends \PHPUnit_Framework_TestCase
];
}
public function testQuotesBadCookieValues()
{
$this->assertEquals('foo', CookieJar::getCookieValue('foo'));
$this->assertEquals('"foo,bar"', CookieJar::getCookieValue('foo,bar'));
$this->assertEquals('"foobar="', CookieJar::getCookieValue('foobar='));
$this->assertEquals('"foo;bar"', CookieJar::getCookieValue('foo;bar'));
}
public function testCreatesFromArray()
{
$jar = CookieJar::fromArray([