Update to Drupal 8.1.7. For more information, see https://www.drupal.org/project/drupal/releases/8.1.7

This commit is contained in:
Pantheon Automation 2016-07-18 09:07:48 -07:00 committed by Greg Anderson
parent 38ba7c357d
commit e9f047ccf8
61 changed files with 1613 additions and 561 deletions

View file

@ -5,7 +5,7 @@ use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
/**
* Cookie jar that stores cookies an an array
* Cookie jar that stores cookies as an array
*/
class CookieJar implements CookieJarInterface
{
@ -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;
}
@ -82,7 +70,7 @@ class CookieJar implements CookieJarInterface
* that survives between requests.
*
* @param SetCookie $cookie Being evaluated.
* @param bool $allowSessionCookies If we should presist session cookies
* @param bool $allowSessionCookies If we should persist session cookies
* @return bool
*/
public static function shouldPersist(
@ -245,10 +233,10 @@ class CookieJar implements CookieJarInterface
if ($cookie->matchesPath($path) &&
$cookie->matchesDomain($host) &&
!$cookie->isExpired() &&
(!$cookie->getSecure() || $scheme == 'https')
(!$cookie->getSecure() || $scheme === 'https')
) {
$values[] = $cookie->getName() . '='
. self::getCookieValue($cookie->getValue());
. $cookie->getValue();
}
}

View file

@ -9,9 +9,9 @@ class FileCookieJar extends CookieJar
/** @var string filename */
private $filename;
/** @var bool Control whether to presist session cookies or not. */
/** @var bool Control whether to persist session cookies or not. */
private $storeSessionCookies;
/**
* Create a new FileCookieJar object
*
@ -55,7 +55,8 @@ class FileCookieJar extends CookieJar
}
}
if (false === file_put_contents($filename, json_encode($json))) {
$jsonStr = \GuzzleHttp\json_encode($json);
if (false === file_put_contents($filename, $jsonStr)) {
throw new \RuntimeException("Unable to save file {$filename}");
}
}
@ -73,9 +74,11 @@ class FileCookieJar extends CookieJar
$json = file_get_contents($filename);
if (false === $json) {
throw new \RuntimeException("Unable to load file {$filename}");
} elseif ($json === '') {
return;
}
$data = json_decode($json, true);
$data = \GuzzleHttp\json_decode($json, true);
if (is_array($data)) {
foreach (json_decode($json, true) as $cookie) {
$this->setCookie(new SetCookie($cookie));

View file

@ -9,7 +9,7 @@ class SessionCookieJar extends CookieJar
/** @var string session key */
private $sessionKey;
/** @var bool Control whether to presist session cookies or not. */
/** @var bool Control whether to persist session cookies or not. */
private $storeSessionCookies;
/**
@ -56,11 +56,10 @@ class SessionCookieJar extends CookieJar
*/
protected function load()
{
$cookieJar = isset($_SESSION[$this->sessionKey])
? $_SESSION[$this->sessionKey]
: null;
$data = json_decode($cookieJar, true);
if (!isset($_SESSION[$this->sessionKey])) {
return;
}
$data = json_decode($_SESSION[$this->sessionKey], true);
if (is_array($data)) {
foreach ($data as $cookie) {
$this->setCookie(new SetCookie($cookie));

View file

@ -86,8 +86,8 @@ class SetCookie
{
$str = $this->data['Name'] . '=' . $this->data['Value'] . '; ';
foreach ($this->data as $k => $v) {
if ($k != 'Name' && $k != 'Value' && $v !== null && $v !== false) {
if ($k == 'Expires') {
if ($k !== 'Name' && $k !== 'Value' && $v !== null && $v !== false) {
if ($k === 'Expires') {
$str .= 'Expires=' . gmdate('D, d M Y H:i:s \G\M\T', $v) . '; ';
} else {
$str .= ($v === true ? $k : "{$k}={$v}") . '; ';
@ -307,7 +307,7 @@ class SetCookie
$cookiePath = $this->getPath();
// Match on exact matches or when path is the default empty "/"
if ($cookiePath == '/' || $cookiePath == $requestPath) {
if ($cookiePath === '/' || $cookiePath == $requestPath) {
return true;
}
@ -317,12 +317,12 @@ class SetCookie
}
// Match if the last character of the cookie-path is "/"
if (substr($cookiePath, -1, 1) == '/') {
if (substr($cookiePath, -1, 1) === '/') {
return true;
}
// Match if the first character not included in cookie path is "/"
return substr($requestPath, strlen($cookiePath), 1) == '/';
return substr($requestPath, strlen($cookiePath), 1) === '/';
}
/**