10000 Merge branch '2.2' into 2.3 · symfony/symfony@686bbb6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 686bbb6

Browse files
committed
Merge branch '2.2' into 2.3
* 2.2: Update JsonResponse.php [HttpKernel] fixed the inline renderer when passing objects as attributes (closes #7124) [WebProfiler] fix content-type parameter Replace romaji period characters with Japanese style zenkaku period characters Passed the config when building the Configuration in ConfigurableExtension Conflicts: src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Resources/config/routing.yml src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php
2 parents 4efac29 + af31180 commit 686bbb6

File tree

12 files changed

+130
-13
lines changed

12 files changed

+130
-13
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\Controller;
13+
14+
use Symfony\Component\HttpFoundation\Request;
15+
use Symfony\Component\HttpFoundation\Response;
16+
use Symfony\Component\DependencyInjection\ContainerAware;
17+
18+
class FragmentController extends ContainerAware
19+
{
20+
public function indexAction()
21+
{
22+
$actions = $this->container->get('templating')->get('actions');
23+
24+
return new Response($actions->render($actions->controller('TestBundle:Fragment:inlined', array(
25+
'options' => array(
26+
'bar' => new Bar(),
27+
'eleven' => 11,
28+
),
29+
))));
30+
}
31+
32+
public function inlinedAction($options, $_format)
33+
{
34+
return new Response($options['bar']->getBar().' '.$_format);
35+
}
36+
}
37+
38+
class Bar
39+
{
40+
private $bar = 'bar';
41+
42+
public function getBar()
43+
{
44+
return $this->bar;
45+
}
46+
}

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Resources/config/routing.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,11 @@ subrequest_fragment:
3636
path: /subrequest/fragment/{_locale}.{_format}
3737
defaults: { _controller: TestBundle:SubRequest:fragment, _format: "html" }
3838
schemes: [http]
39+
40+
fragment_home:
41+
path: /fragment_home
42+
defaults: { _controller: TestBundle:Fragment:index, _format: txt }
43+
44+
fragment_inlined:
45+
path: /fragment_inlined
46+
defaults: { _controller: TestBundle:Fragment:inlined }
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
13+
14+
/**
15+
* @group functional
16+
*/
17+
class FragmentTest extends WebTestCase
18+
{
19+
/**
20+
* @dataProvider getConfigs
21+
*/
22+
public function testFragment($insulate)
23+
{
24+
$client = $this->createClient(array('test_case' => 'Fragment', 'root_config' => 'config.yml'));
25+
if ($insulate) {
26+
$client->insulate();
27+
}
28+
29+
$client->request('GET', '/fragment_home');
30+
31+
$this->assertEquals('bar txt', $client->getResponse()->getContent());
32+
}
33+
34+
public function getConfigs()
35+
{
36+
return array(
37+
array(false),
38+
array(true),
39+
);
40+
}
41+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
use Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\TestBundle;
4+
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
5+
6+
return array(
7+
new FrameworkBundle(),
8+
new TestBundle(),
9+
);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
imports:
2+
- { resource: ../config/default.yml }
3+
4+
framework:
5+
fragments: ~
6+
templating:
7+
engines: ['php']
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
_fragmenttest_bundle:
2+
resource: @TestBundle/Resources/config/routing.yml

src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ public function cssAction($token)
9393
if (!$this->templateExists($template)) {
9494
$handler = new ExceptionHandler();
9595

96-
return new Response($handler->getStylesheet($exception));
96+
return new Response($handler->getStylesheet($exception), 200, array('Content-Type' => 'text/css'));
9797
}
9898

99-
return new Response($this->twig->render('@WebProfiler/Collector/exception.css.twig'), 200, 'text/css');
99+
return new Response($this->twig->render('@WebProfiler/Collector/exception.css.twig'), 200, array('Content-Type' => 'text/css'));
100100
}
101101

102102
protected function getTemplate()

src/Symfony/Component/HttpFoundation/JsonResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function setCallback($callback = null)
8989
public function setData($data = array())
9090
{
9191
// Encode <, >, ', &, and " for RFC4627-compliant JSON, which may also be embedded into HTML.
92-
$this->data = json_encode($data, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT);
92+
$this->data = json_encode($data, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_NUMERIC_CHECK);
9393

9494
return $this->update();
9595
}

src/Symfony/Component/HttpKernel/DependencyInjection/ConfigurableExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ abstract class ConfigurableExtension extends Extension
3232
*/
3333
final public function load(array $configs, ContainerBuilder $container)
3434
{
35-
$this->loadInternal($this->processConfiguration($this->getConfiguration(array(), $container), $configs), $container);
35+
$this->loadInternal($this->processConfiguration($this->getConfiguration($configs, $container), $configs), $container);
3636
}
3737

3838
/**

src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,15 @@ public function render($uri, Request $request, array $options = array())
5252
$reference = null;
5353
if ($uri instanceof ControllerReference) {
5454
$reference = $uri;
55+
56+
// Remove attributes from the genereated URI because if not, the Symfony
57+
// routing system will use them to populate the Request attributes. We don't
58+
// want that as we want to preserve objects (so we manually set Request attributes
59+
// below instead)
60+
$attributes = $reference->attributes;
61+
$reference->attributes = array();
5562
$uri = $this->generateFragmentUri($uri, $request);
63+
$reference->attributes = $attributes;
5664
}
5765

5866
$subRequest = $this->createSubRequest($uri, $request);

src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,7 @@ public function testRenderWithObjectsAsAttributes()
5151
$object = new \stdClass();
5252

5353
$subRequest = Request::create('/_fragment?_path=_format%3Dhtml%26_controller%3Dmain_controller');
54-
$subRequest->attributes->replace(array(
55-
'object' => $object,
56-
'_format' => 'html',
57-
'_controller' => 'main_controller',
58-
));
54+
$subRequest->attributes->replace(array('object' => $object));
5955
$subRequest->headers->set('x-forwarded-for', array('127.0.0.1'));
6056
$subRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1');
6157

src/Symfony/Component/Validator/Resources/translations/validators.ja.xlf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424
</trans-unit>
2525
<trans-unit id="6">
2626
<source>You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices.</source>
27-
<target>{{ limit }}個以上選択してください.</target>
27+
<target>{{ limit }}個以上選択してください</target>
2828
</trans-unit>
2929
<trans-unit id="7">
3030
<source>You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices.</source>
31-
<target>{{ limit }}個以内で選択してください.</target>
31+
<target>{{ limit }}個以内で選択してください</target>
3232
</trans-unit>
3333
<trans-unit id="8">
3434
<source>One or more of the given values is invalid.</source>
@@ -76,15 +76,15 @@
7676
</trans-unit>
7777
<trans-unit id="19">
7878
<source>This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.</source>
79-
<target>値が長すぎます。{{ limit }}文字以内でなければなりません.</target>
79+
<target>値が長すぎます。{{ limit }}文字以内でなければなりません</target>
8080
</trans-unit>
8181
<trans-unit id="20">
8282
<source>This value should be {{ limit }} or more.</source>
8383
<target>{{ limit }}以上でなければなりません。</target>
8484
</trans-unit>
8585
<trans-unit id="21">
8686
<source>This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.</source>
87-
<target>値が短すぎます。{{ limit }}文字以上でなければなりません.</target>
87+
<target>値が短すぎます。{{ limit }}文字以上でなければなりません</target>
8888
</trans-unit>
8989
<trans-unit id="22">
9090
<source>This value should not be blank.</source>

0 commit comments

Comments
 (0)
0