Update to Drupal 8.0.0-rc3. For more information, see https://www.drupal.org/node/2608078

This commit is contained in:
Pantheon Automation 2015-11-04 11:11:27 -08:00 committed by Greg Anderson
parent 6419a031d7
commit 4afb23bbd3
762 changed files with 20080 additions and 6368 deletions

View file

@ -26,7 +26,7 @@ class MockFileFinder implements ClassFinderInterface {
protected $filename;
/**
* Implements Doctrine\Common\Reflection\ClassFinderInterface::findFile().
* {@inheritdoc}
*/
public function findFile($class) {
return $this->filename;

View file

@ -71,7 +71,7 @@ class ContainerAwareEventDispatcher implements EventDispatcherInterface {
/**
* Constructs a container aware event dispatcher.
*
* @param \Symfony\Component\EventDispatcher\IntrospectableContainerInterface $container
* @param \Symfony\Component\DependencyInjection\IntrospectableContainerInterface $container
* The service container.
* @param array $listeners
* A nested array of listener definitions keyed by event name and priority.

View file

@ -27,7 +27,7 @@ class PoMemoryWriter implements PoWriterInterface {
}
/**
* Implements Drupal\Component\Gettext\PoWriterInterface::writeItem().
* {@inheritdoc}
*/
public function writeItem(PoItem $item) {
if (is_array($item->getSource())) {
@ -39,7 +39,7 @@ class PoMemoryWriter implements PoWriterInterface {
}
/**
* Implements Drupal\Component\Gettext\PoWriterInterface::writeItems().
* {@inheritdoc}
*/
public function writeItems(PoReaderInterface $reader, $count = -1) {
$forever = $count == -1;

View file

@ -103,21 +103,21 @@ class PoStreamReader implements PoStreamInterface, PoReaderInterface {
private $_errors;
/**
* Implements Drupal\Component\Gettext\PoMetadataInterface::getLangcode().
* {@inheritdoc}
*/
public function getLangcode() {
return $this->_langcode;
}
/**
* Implements Drupal\Component\Gettext\PoMetadataInterface::setLangcode().
* {@inheritdoc}
*/
public function setLangcode($langcode) {
$this->_langcode = $langcode;
}
/**
* Implements Drupal\Component\Gettext\PoMetadataInterface::getHeader().
* {@inheritdoc}
*/
public function getHeader() {
return $this->_header;
@ -132,14 +132,14 @@ class PoStreamReader implements PoStreamInterface, PoReaderInterface {
}
/**
* Implements Drupal\Component\Gettext\PoStreamInterface::getURI().
* {@inheritdoc}
*/
public function getURI() {
return $this->_uri;
}
/**
* Implements Drupal\Component\Gettext\PoStreamInterface::setURI().
* {@inheritdoc}
*/
public function setURI($uri) {
$this->_uri = $uri;
@ -180,7 +180,7 @@ class PoStreamReader implements PoStreamInterface, PoReaderInterface {
}
/**
* Implements Drupal\Component\Gettext\PoReaderInterface::readItem().
* {@inheritdoc}
*/
public function readItem() {
// Clear out the last item.

View file

@ -74,7 +74,7 @@ class PoStreamWriter implements PoWriterInterface, PoStreamInterface {
}
/**
* Implements Drupal\Component\Gettext\PoStreamInterface::open().
* {@inheritdoc}
*/
public function open() {
// Open in write mode. Will overwrite the stream if it already exists.
@ -123,14 +123,14 @@ class PoStreamWriter implements PoWriterInterface, PoStreamInterface {
}
/**
* Implements Drupal\Component\Gettext\PoWriterInterface::writeItem().
* {@inheritdoc}
*/
public function writeItem(PoItem $item) {
$this->write($item);
}
/**
* Implements Drupal\Component\Gettext\PoWriterInterface::writeItems().
* {@inheritdoc}
*/
public function writeItems(PoReaderInterface $reader, $count = -1) {
$forever = $count == -1;
@ -153,7 +153,7 @@ class PoStreamWriter implements PoWriterInterface, PoStreamInterface {
}
/**
* Implements Drupal\Component\Gettext\PoStreamInterface::setURI().
* {@inheritdoc}
*/
public function setURI($uri) {
$this->_uri = $uri;

View file

@ -46,6 +46,11 @@ abstract class SecuredRedirectResponse extends RedirectResponse {
protected function fromResponse(RedirectResponse $response) {
$this->setProtocolVersion($response->getProtocolVersion());
$this->setCharset($response->getCharset());
// Cookies are separate from other headers and have to be copied over
// directly.
foreach ($response->headers->getCookies() as $cookie) {
$this->headers->setCookie($cookie);
}
}
/**

View file

@ -34,14 +34,14 @@ class FileReadOnlyStorage implements PhpStorageInterface {
}
/**
* Implements Drupal\Component\PhpStorage\PhpStorageInterface::exists().
* {@inheritdoc}
*/
public function exists($name) {
return file_exists($this->getFullPath($name));
}
/**
* Implements Drupal\Component\PhpStorage\PhpStorageInterface::load().
* {@inheritdoc}
*/
public function load($name) {
// The FALSE returned on failure is enough for the caller to handle this,
@ -50,14 +50,14 @@ class FileReadOnlyStorage implements PhpStorageInterface {
}
/**
* Implements Drupal\Component\PhpStorage\PhpStorageInterface::save().
* {@inheritdoc}
*/
public function save($name, $code) {
return FALSE;
}
/**
* Implements Drupal\Component\PhpStorage\PhpStorageInterface::delete().
* {@inheritdoc}
*/
public function delete($name) {
return FALSE;
@ -71,14 +71,14 @@ class FileReadOnlyStorage implements PhpStorageInterface {
}
/**
* Implements Drupal\Component\PhpStorage\PhpStorageInterface::writeable().
* {@inheritdoc}
*/
function writeable() {
return FALSE;
}
/**
* Implements Drupal\Component\PhpStorage\PhpStorageInterface::deleteAll().
* {@inheritdoc}
*/
public function deleteAll() {
return FALSE;

View file

@ -33,14 +33,14 @@ class FileStorage implements PhpStorageInterface {
}
/**
* Implements Drupal\Component\PhpStorage\PhpStorageInterface::exists().
* {@inheritdoc}
*/
public function exists($name) {
return file_exists($this->getFullPath($name));
}
/**
* Implements Drupal\Component\PhpStorage\PhpStorageInterface::load().
* {@inheritdoc}
*/
public function load($name) {
// The FALSE returned on failure is enough for the caller to handle this,
@ -49,7 +49,7 @@ class FileStorage implements PhpStorageInterface {
}
/**
* Implements Drupal\Component\PhpStorage\PhpStorageInterface::save().
* {@inheritdoc}
*/
public function save($name, $code) {
$path = $this->getFullPath($name);
@ -183,7 +183,7 @@ EOF;
}
/**
* Implements Drupal\Component\PhpStorage\PhpStorageInterface::delete().
* {@inheritdoc}
*/
public function delete($name) {
$path = $this->getFullPath($name);
@ -201,14 +201,14 @@ EOF;
}
/**
* Implements Drupal\Component\PhpStorage\PhpStorageInterface::writeable().
* {@inheritdoc}
*/
public function writeable() {
return TRUE;
}
/**
* Implements Drupal\Component\PhpStorage\PhpStorageInterface::deleteAll().
* {@inheritdoc}
*/
public function deleteAll() {
return $this->unlink($this->directory);

View file

@ -36,7 +36,7 @@ namespace Drupal\Component\PhpStorage;
class MTimeProtectedFileStorage extends MTimeProtectedFastFileStorage {
/**
* Implements Drupal\Component\PhpStorage\PhpStorageInterface::load().
* {@inheritdoc}
*/
public function load($name) {
if (($filename = $this->checkFile($name)) !== FALSE) {
@ -47,7 +47,7 @@ class MTimeProtectedFileStorage extends MTimeProtectedFastFileStorage {
}
/**
* Implements Drupal\Component\PhpStorage\PhpStorageInterface::exists().
* {@inheritdoc}
*/
public function exists($name) {
return $this->checkFile($name) !== FALSE;

View file

@ -44,7 +44,7 @@ class Context implements ContextInterface {
}
/**
* Implements \Drupal\Component\Plugin\Context\ContextInterface::getContextValue().
* {@inheritdoc}
*/
public function getContextValue() {
// Support optional contexts.
@ -71,14 +71,14 @@ class Context implements ContextInterface {
}
/**
* Implements \Drupal\Component\Plugin\Context\ContextInterface::getContextDefinition().
* {@inheritdoc}
*/
public function getContextDefinition() {
return $this->contextDefinition;
}
/**
* Implements \Drupal\Component\Plugin\Context\ContextInterface::getConstraints().
* {@inheritdoc}
*/
public function getConstraints() {
if (empty($this->contextDefinition['class'])) {
@ -88,7 +88,7 @@ class Context implements ContextInterface {
}
/**
* Implements \Drupal\Component\Plugin\Context\ContextInterface::validate().
* {@inheritdoc}
*/
public function validate() {
$validator = Validation::createValidatorBuilder()

View file

@ -33,22 +33,22 @@ interface ContextAwarePluginInterface extends PluginInspectionInterface {
* @param string $name
* The name of the context in the plugin definition.
*
* @throws \Drupal\Component\Plugin\Exception\PluginException
* If the requested context is not defined.
*
* @return \Drupal\Component\Plugin\Context\ContextDefinitionInterface.
* The definition against which the context value must validate.
*
* @throws \Drupal\Component\Plugin\Exception\PluginException
* If the requested context is not defined.
*/
public function getContextDefinition($name);
/**
* Gets the defined contexts.
*
* @throws \Drupal\Component\Plugin\Exception\PluginException
* If contexts are defined but not set.
*
* @return array
* The set context objects.
*
* @throws \Drupal\Component\Plugin\Exception\PluginException
* If contexts are defined but not set.
*/
public function getContexts();
@ -58,11 +58,11 @@ interface ContextAwarePluginInterface extends PluginInspectionInterface {
* @param string $name
* The name of the context in the plugin definition.
*
* @throws \Drupal\Component\Plugin\Exception\PluginException
* If the requested context is not set.
*
* @return \Drupal\Component\Plugin\Context\ContextInterface
* The context object.
*
* @throws \Drupal\Component\Plugin\Exception\PluginException
* If the requested context is not set.
*/
public function getContext($name);
@ -81,11 +81,11 @@ interface ContextAwarePluginInterface extends PluginInspectionInterface {
* @param string $name
* The name of the context in the plugin configuration.
*
* @throws \Drupal\Component\Plugin\Exception\PluginException
* If the requested context is not set.
*
* @return mixed
* The currently set context value.
*
* @throws \Drupal\Component\Plugin\Exception\PluginException
* If the requested context is not set.
*/
public function getContextValue($name);
@ -108,11 +108,11 @@ interface ContextAwarePluginInterface extends PluginInspectionInterface {
* The value to set the context to. The value has to validate against the
* provided context definition.
*
* @throws \Drupal\Component\Plugin\Exception\PluginException
* If the value does not pass validation.
*
* @return \Drupal\Component\Plugin\ContextAwarePluginInterface.
* A context aware plugin object for chaining.
*
* @throws \Drupal\Component\Plugin\Exception\PluginException
* If the value does not pass validation.
*/
public function setContextValue($name, $value);

View file

@ -2,7 +2,7 @@
/**
* @file
* Contains \Drupal\Component\Plugin\PluginDefinitionInterface.
* Contains \Drupal\Component\Plugin\Definition\PluginDefinitionInterface.
*/
namespace Drupal\Component\Plugin\Definition;

View file

@ -16,7 +16,7 @@ class StaticDiscovery implements DiscoveryInterface {
use DiscoveryCachedTrait;
/**
* Implements Drupal\Component\Plugin\Discovery\DiscoveryInterface::getDefinitions().
* {@inheritdoc}
*/
public function getDefinitions() {
if (!$this->definitions) {

View file

@ -52,7 +52,7 @@ class StaticDiscoveryDecorator extends StaticDiscovery {
}
/**
* Implements Drupal\Component\Plugin\Discovery\DiscoveryInterface::getDefinitions().
* {@inheritdoc}
*/
public function getDefinitions() {
if (isset($this->registerDefinitions)) {

View file

@ -51,7 +51,7 @@ class DefaultFactory implements FactoryInterface {
}
/**
* Implements Drupal\Component\Plugin\Factory\FactoryInterface::createInstance().
* {@inheritdoc}
*/
public function createInstance($plugin_id, array $configuration = array()) {
$plugin_definition = $this->discovery->getDefinition($plugin_id);

View file

@ -15,7 +15,7 @@ namespace Drupal\Component\Plugin\Factory;
class ReflectionFactory extends DefaultFactory {
/**
* Implements Drupal\Component\Plugin\Factory\FactoryInterface::createInstance().
* {@inheritdoc}
*/
public function createInstance($plugin_id, array $configuration = array()) {
$plugin_definition = $this->discovery->getDefinition($plugin_id);

View file

@ -2,7 +2,7 @@
/**
* @file
* Contains Drupal\Component\Render\FormattableMarkup.
* Contains \Drupal\Component\Render\FormattableMarkup.
*/
namespace Drupal\Component\Render;
@ -65,7 +65,7 @@ use Drupal\Component\Utility\UrlHelper;
* @see \Drupal\Core\StringTranslation\PluralTranslatableMarkup
* @see \Drupal\Component\Render\FormattableMarkup::placeholderFormat()
*/
class FormattableMarkup implements MarkupInterface {
class FormattableMarkup implements MarkupInterface, \Countable {
/**
* The arguments to replace placeholders with.
@ -223,7 +223,6 @@ class FormattableMarkup implements MarkupInterface {
break;
case '%':
default:
// Similarly to @, escape non-safe values. Also, add wrapping markup
// in order to render as a placeholder. Not for use within attributes,
// per the warning above about
@ -231,6 +230,16 @@ class FormattableMarkup implements MarkupInterface {
// due to the wrapping markup.
$args[$key] = '<em class="placeholder">' . static::placeholderEscape($value) . '</em>';
break;
default:
// We do not trigger an error for placeholder that start with an
// alphabetic character.
if (!ctype_alpha($key[0])) {
// We trigger an error as we may want to introduce new placeholders
// in the future without breaking backward compatibility.
trigger_error('Invalid placeholder: ' . $key, E_USER_ERROR);
}
break;
}
}

View file

@ -18,7 +18,7 @@ use Drupal\Component\Utility\Unicode;
*
* @ingroup sanitization
*/
class HtmlEscapedText implements MarkupInterface {
class HtmlEscapedText implements MarkupInterface, \Countable {
/**
* The string to escape.

View file

@ -41,6 +41,13 @@ class Crypt {
$bytes .= openssl_random_pseudo_bytes($missing_bytes);
}
// If OpenSSL is not available, we can use mcrypt. On Windows, this will
// transparently pull from CryptGenRandom. On Unix-based systems, it will
// read from /dev/urandom as expected.
elseif (function_exists(('mcrypt_create_iv')) && defined('MCRYPT_DEV_URANDOM')) {
$bytes .= mcrypt_create_iv($count, MCRYPT_DEV_URANDOM);
}
// Else, read directly from /dev/urandom, which is available on many *nix
// systems and is considered cryptographically secure.
elseif ($fh = @fopen('/dev/urandom', 'rb')) {
@ -125,6 +132,49 @@ class Crypt {
return str_replace(['+', '/', '='], ['-', '_', ''], $hash);
}
/**
* Compares strings in constant time.
*
* @param string $known_string
* The expected string.
* @param string $user_string
* The user supplied string to check.
*
* @return bool
* Returns TRUE when the two strings are equal, FALSE otherwise.
*/
public static function hashEquals($known_string, $user_string) {
if (function_exists('hash_equals')) {
return hash_equals($known_string, $user_string);
}
else {
// Backport of hash_equals() function from PHP 5.6
// @see https://github.com/php/php-src/blob/PHP-5.6/ext/hash/hash.c#L739
if (!is_string($known_string)) {
trigger_error(sprintf("Expected known_string to be a string, %s given", gettype($known_string)), E_USER_WARNING);
return FALSE;
}
if (!is_string($user_string)) {
trigger_error(sprintf("Expected user_string to be a string, %s given", gettype($user_string)), E_USER_WARNING);
return FALSE;
}
$known_len = strlen($known_string);
if ($known_len !== strlen($user_string)) {
return FALSE;
}
// This is security sensitive code. Do not optimize this for speed.
$result = 0;
for ($i = 0; $i < $known_len; $i++) {
$result |= (ord($known_string[$i]) ^ ord($user_string[$i]));
}
return $result === 0;
}
}
/**
* Returns a URL-safe, base64 encoded string of highly randomized bytes.
*