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

This commit is contained in:
Pantheon Automation 2015-09-04 13:20:09 -07:00 committed by Greg Anderson
parent 2720a9ec4b
commit f3791f1da3
1898 changed files with 54300 additions and 11481 deletions

View file

@ -101,6 +101,13 @@ class AjaxResponseSubscriber implements EventSubscriberInterface {
// @see https://www.drupal.org/node/1009382
$response->setContent('<textarea>' . $response->getContent() . '</textarea>');
}
// User-uploaded files cannot set any response headers, so a custom header
// is used to indicate to ajax.js that this response is safe. Note that
// most Ajax requests bound using the Form API will be protected by having
// the URL flagged as trusted in Drupal.settings, so this header is used
// only for things like custom markup that gets Ajax behaviors attached.
$response->headers->set('X-Drupal-Ajax-Token', 1);
}
}

View file

@ -161,7 +161,7 @@ class DefaultExceptionHtmlSubscriber extends HttpExceptionSubscriberBase {
// just log it. The DefaultExceptionSubscriber will catch the original
// exception and handle it normally.
$error = Error::decodeException($e);
$this->logger->log($error['severity_level'], '%type: !message in %function (line %line of %file).', $error);
$this->logger->log($error['severity_level'], '%type: @message in %function (line %line of %file).', $error);
}
}
}

View file

@ -91,12 +91,20 @@ class DefaultExceptionSubscriber implements EventSubscriberInterface {
if (substr($error['%file'], 0, $root_length) == DRUPAL_ROOT) {
$error['%file'] = substr($error['%file'], $root_length + 1);
}
// Do not translate the string to avoid errors producing more errors.
unset($error['backtrace']);
$message = SafeMarkup::format('%type: !message in %function (line %line of %file).', $error);
// Check if verbose error reporting is on.
if ($this->getErrorLevel() == ERROR_REPORTING_DISPLAY_VERBOSE) {
unset($error['backtrace']);
if ($this->getErrorLevel() != ERROR_REPORTING_DISPLAY_VERBOSE) {
// Without verbose logging, use a simple message.
// We call SafeMarkup::format directly here, rather than use t() since
// we are in the middle of error handling, and we don't want t() to
// cause further errors.
$message = SafeMarkup::format('%type: @message in %function (line %line of %file).', $error);
}
else {
// With verbose logging, we will also include a backtrace.
$backtrace_exception = $exception;
while ($backtrace_exception->getPrevious()) {
$backtrace_exception = $backtrace_exception->getPrevious();
@ -108,9 +116,9 @@ class DefaultExceptionSubscriber implements EventSubscriberInterface {
// once more in the backtrace.
array_shift($backtrace);
// Generate a backtrace containing only scalar argument values. Make
// sure the backtrace is escaped as it can contain user submitted data.
$message .= '<pre class="backtrace">' . SafeMarkup::escape(Error::formatBacktrace($backtrace)) . '</pre>';
// Generate a backtrace containing only scalar argument values.
$error['@backtrace'] = Error::formatBacktrace($backtrace);
$message = SafeMarkup::format('%type: @message in %function (line %line of %file). <pre class="backtrace">@backtrace</pre>', $error);
}
}

View file

@ -68,7 +68,7 @@ class ExceptionLoggingSubscriber implements EventSubscriberInterface {
public function onError(GetResponseForExceptionEvent $event) {
$exception = $event->getException();
$error = Error::decodeException($exception);
$this->logger->get('php')->log($error['severity_level'], '%type: !message in %function (line %line of %file).', $error);
$this->logger->get('php')->log($error['severity_level'], '%type: @message in %function (line %line of %file).', $error);
$is_critical = !$exception instanceof HttpExceptionInterface || $exception->getStatusCode() >= 500;
if ($is_critical) {

View file

@ -51,7 +51,7 @@ class ExceptionTestSiteSubscriber extends HttpExceptionSubscriberBase {
// as it uniquely identifies each PHP error.
static $number = 0;
$assertion = array(
$error['!message'],
$error['@message'],
$error['%type'],
array(
'function' => $error['%function'],

View file

@ -8,7 +8,7 @@
namespace Drupal\Core\EventSubscriber;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Component\Utility\Html;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpKernel\HttpKernelInterface;
@ -79,7 +79,7 @@ class Fast404ExceptionHtmlSubscriber extends HttpExceptionSubscriberBase {
if ($config->get('fast_404.enabled') && $exclude_paths && !preg_match($exclude_paths, $request->getPathInfo())) {
$fast_paths = $config->get('fast_404.paths');
if ($fast_paths && preg_match($fast_paths, $request->getPathInfo())) {
$fast_404_html = strtr($config->get('fast_404.html'), ['@path' => SafeMarkup::checkPlain($request->getUri())]);
$fast_404_html = strtr($config->get('fast_404.html'), ['@path' => Html::escape($request->getUri())]);
$response = new Response($fast_404_html, Response::HTTP_NOT_FOUND);
$event->setResponse($response);
}

View file

@ -90,7 +90,7 @@ class FinishResponseSubscriber implements EventSubscriberInterface {
/**
* Sets extra headers on successful responses.
*
* @param Symfony\Component\HttpKernel\Event\FilterResponseEvent $event
* @param \Symfony\Component\HttpKernel\Event\FilterResponseEvent $event
* The event to process.
*/
public function onRespond(FilterResponseEvent $event) {

View file

@ -7,6 +7,8 @@
namespace Drupal\Core\EventSubscriber;
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Cache\CacheableResponseInterface;
use Drupal\Core\DependencyInjection\ClassResolverInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
@ -90,7 +92,14 @@ class MainContentViewSubscriber implements EventSubscriberInterface {
$wrapper = isset($this->mainContentRenderers[$wrapper]) ? $wrapper : 'html';
$renderer = $this->classResolver->getInstanceFromDefinition($this->mainContentRenderers[$wrapper]);
$event->setResponse($renderer->renderResponse($result, $request, $this->routeMatch));
$response = $renderer->renderResponse($result, $request, $this->routeMatch);
// The main content render array is rendered into a different Response
// object, depending on the specified wrapper format.
if ($response instanceof CacheableResponseInterface) {
$main_content_view_subscriber_cacheability = (new CacheableMetadata())->setCacheContexts(['url.query_args:' . static::WRAPPER_FORMAT]);
$response->addCacheableDependency($main_content_view_subscriber_cacheability);
}
$event->setResponse($response);
}
}

View file

@ -44,14 +44,10 @@ class SpecialAttributesRouteSubscriber extends RouteSubscriberBase {
*
* @param \Drupal\Core\Routing\RouteBuildEvent $event
* The route build event.
*
* @return bool
* Returns TRUE if the variables were successfully replaced, otherwise
* FALSE.
*/
public function onAlterRoutes(RouteBuildEvent $event) {
$collection = $event->getRouteCollection();
return $this->alterRoutes($collection);
$this->alterRoutes($collection);
}
}