Skip to content

Commit

Permalink
Merge branch '3.4' into 4.2
Browse files Browse the repository at this point in the history
* 3.4:
  [Form] Fix author tag + exception messages
  [TwigBridge] Fix deprecation on twig 2.9
  [Validator] Fixed imprecise translations
  [Validator] Add Dutch translations
  Intercept redirections only for HTML format
  Fix name and phpdoc of ContainerBuilder::removeBindings
  [Intl] Update the ICU data to 64.2
  • Loading branch information
Robin Chalas committed Apr 27, 2019
2 parents ada9aa0 + a975d2b commit 7947b26
Show file tree
Hide file tree
Showing 296 changed files with 454 additions and 399 deletions.
Expand Up @@ -24,6 +24,7 @@
use Twig\Node\Node;
use Twig\Node\SetNode;
use Twig\NodeVisitor\AbstractNodeVisitor;
use Twig\TokenParser\ApplyTokenParser;

/**
* @author Fabien Potencier <fabien@symfony.com>
Expand Down Expand Up @@ -95,7 +96,8 @@ protected function doEnterNode(Node $node, Environment $env)
protected function doLeaveNode(Node $node, Environment $env)
{
if ($node instanceof TransDefaultDomainNode) {
return false;
// must return null as of Twig 2.9
return class_exists(ApplyTokenParser::class) ? null : false;
}

if ($node instanceof BlockNode || $node instanceof ModuleNode) {
Expand Down
Expand Up @@ -85,7 +85,7 @@ public function onKernelResponse(FilterResponseEvent $event)
return;
}

if ($response->headers->has('X-Debug-Token') && $response->isRedirect() && $this->interceptRedirects) {
if ($response->headers->has('X-Debug-Token') && $response->isRedirect() && $this->interceptRedirects && 'html' === $request->getRequestFormat()) {
$session = $request->getSession();
if (null !== $session && $session->isStarted() && $session->getFlashBag() instanceof AutoExpireFlashBag) {
// keep current flashes for one more request if using AutoExpireFlashBag
Expand Down
Expand Up @@ -58,7 +58,7 @@ public function getInjectToolbarTests()
/**
* @dataProvider provideRedirects
*/
public function testRedirectionIsIntercepted($statusCode, $hasSession)
public function testHtmlRedirectionIsIntercepted($statusCode, $hasSession)
{
$response = new Response('Some content', $statusCode);
$response->headers->set('X-Debug-Token', 'xxxxxxxx');
Expand All @@ -71,6 +71,19 @@ public function testRedirectionIsIntercepted($statusCode, $hasSession)
$this->assertEquals('Redirection', $response->getContent());
}

public function testNonHtmlRedirectionIsNotIntercepted()
{
$response = new Response('Some content', '301');
$response->headers->set('X-Debug-Token', 'xxxxxxxx');
$event = new FilterResponseEvent($this->getKernelMock(), $this->getRequestMock(false, 'json', true), HttpKernelInterface::MASTER_REQUEST, $response);

$listener = new WebDebugToolbarListener($this->getTwigMock('Redirection'), true);
$listener->onKernelResponse($event);

$this->assertEquals(301, $response->getStatusCode());
$this->assertEquals('Some content', $response->getContent());
}

public function testToolbarIsInjected()
{
$response = new Response('<html><head></head><body></body></html>');
Expand Down
Expand Up @@ -1483,13 +1483,13 @@ public function getRemovedBindingIds()
}

/**
* Adds a removed binding id.
* Removes bindings for a service.
*
* @param int $id
* @param string $id The service identifier
*
* @internal
*/
public function addRemovedBindingIds($id)
public function removeBindings($id)
{
if ($this->hasDefinition($id)) {
foreach ($this->getDefinition($id)->getBindings() as $key => $binding) {
Expand Down
Expand Up @@ -59,7 +59,7 @@ public function __destruct()
{
parent::__destruct();

$this->container->addRemovedBindingIds($this->id);
$this->container->removeBindings($this->id);

if (!$this->definition instanceof ChildDefinition) {
$this->container->setDefinition($this->id, $this->definition->setInstanceofConditionals($this->instanceof));
Expand Down
Expand Up @@ -91,7 +91,7 @@ public function registerClasses(Definition $prototype, $namespace, $resource, $e
*/
protected function setDefinition($id, Definition $definition)
{
$this->container->addRemovedBindingIds($id);
$this->container->removeBindings($id);

if ($this->isLoadingInstanceof) {
if (!$definition instanceof ChildDefinition) {
Expand Down
Expand Up @@ -17,7 +17,7 @@
/**
* Transforms between a timezone identifier string and a DateTimeZone object.
*
* @author Roland Franssen <franssen.roland@gmai.com>
* @author Roland Franssen <franssen.roland@gmail.com>
*/
class DateTimeZoneToStringTransformer implements DataTransformerInterface
{
Expand All @@ -39,14 +39,14 @@ public function transform($dateTimeZone)

if ($this->multiple) {
if (!\is_array($dateTimeZone)) {
throw new TransformationFailedException('Expected an array.');
throw new TransformationFailedException('Expected an array of \DateTimeZone objects.');
}

return array_map([new self(), 'transform'], $dateTimeZone);
}

if (!$dateTimeZone instanceof \DateTimeZone) {
throw new TransformationFailedException('Expected a \DateTimeZone.');
throw new TransformationFailedException('Expected a \DateTimeZone object.');
}

return $dateTimeZone->getName();
Expand All @@ -63,14 +63,14 @@ public function reverseTransform($value)

if ($this->multiple) {
if (!\is_array($value)) {
throw new TransformationFailedException('Expected an array.');
throw new TransformationFailedException('Expected an array of timezone identifier strings.');
}

return array_map([new self(), 'reverseTransform'], $value);
}

if (!\is_string($value)) {
throw new TransformationFailedException('Expected a string.');
throw new TransformationFailedException('Expected a timezone identifier string.');
}

try {
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Intl/Intl.php
Expand Up @@ -235,7 +235,7 @@ public static function getIcuDataVersion()
*/
public static function getIcuStubVersion()
{
return '64.1';
return '64.2';
}

/**
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.48.18",
"Version": "2.1.49.82",
"Names": {
"AED": [
"AED",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.48.22",
"Version": "2.1.49.82",
"Names": {
"ADP": [
"ADP",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.48.17",
"Version": "2.1.49.82",
"Names": {
"ADP": [
"ADP",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.48.17",
"Version": "2.1.49.82",
"Names": {
"AED": [
"AED",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.48.17",
"Version": "2.1.49.82",
"Names": {
"ADP": [
"ADP",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.48.17",
"Version": "2.1.49.82",
"Names": {
"ADP": [
"ADP",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.48.17",
"Version": "2.1.49.82",
"Names": {
"AED": [
"AED",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.48.17",
"Version": "2.1.49.82",
"Names": {
"ADP": [
"ADP",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.49.26",
"Version": "2.1.49.82",
"Names": {
"ADP": [
"ADP",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.48.20",
"Version": "2.1.49.82",
"Names": {
"ADP": [
"ADP",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.48.17",
"Version": "2.1.49.82",
"Names": {
"AED": [
"AED",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.48.42",
"Version": "2.1.49.82",
"Names": {
"ADP": [
"ADP",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.48.43",
"Version": "2.1.49.82",
"Names": {
"ADP": [
"ADP",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.48.17",
"Version": "2.1.49.82",
"Names": {
"ADP": [
"ADP",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.48.86",
"Version": "2.1.49.82",
"Names": {
"ADP": [
"ADP",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.48.17",
"Version": "2.1.49.82",
"Names": {
"ADP": [
"ADP",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.48.17",
"Version": "2.1.49.82",
"Names": {
"AED": [
"AED",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.48.17",
"Version": "2.1.49.82",
"Names": {
"AED": [
"AED",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.48.17",
"Version": "2.1.49.82",
"Names": {
"ADP": [
"ADP",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.48.42",
"Version": "2.1.49.82",
"Names": {
"ADP": [
"ADP",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.48.17",
"Version": "2.1.49.82",
"Names": {
"AED": [
"AED",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.48.17",
"Version": "2.1.49.82",
"Names": {
"AED": [
"AED",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.48.17",
"Version": "2.1.49.82",
"Names": {
"ADP": [
"ADP",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.48.17",
"Version": "2.1.49.82",
"Names": {
"AED": [
"AED",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.47.82",
"Version": "2.1.49.82",
"Names": {
"ADP": [
"ADP",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.47.82",
"Version": "2.1.49.82",
"Currencies": [
"ADP",
"AED",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.47.85",
"Version": "2.1.49.82",
"Names": {
"ANG": [
"ANG",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.48.20",
"Version": "2.1.49.82",
"Names": {
"ADP": [
"ADP",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.47.72",
"Version": "2.1.49.82",
"Names": {
"AED": [
"AED",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.48.36",
"Version": "2.1.49.82",
"Names": {
"AED": [
"AED",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.48.17",
"Version": "2.1.49.82",
"Names": {
"AED": [
"AED",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.48.86",
"Version": "2.1.49.82",
"Names": {
"ADP": [
"ADP",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.47.82",
"Version": "2.1.49.82",
"Names": {
"ADP": [
"ADP",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.48.17",
"Version": "2.1.49.82",
"Names": {
"AED": [
"AED",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.48.17",
"Version": "2.1.49.82",
"Names": {
"AFA": [
"AFA",
Expand Down
@@ -1,5 +1,5 @@
{
"Version": "2.1.47.89",
"Version": "2.1.49.82",
"Names": {
"AED": [
"AED",
Expand Down

0 comments on commit 7947b26

Please sign in to comment.