Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 702e652

Browse files
committed
Merge branch '2.2' into 2.3
* 2.2: Fixing singular form for kisses, accesses and addresses. fixed some circular references [Security] fixed a leak in ExceptionListener [Security] fixed a leak in the ContextListener Ignore posix_istatty warnings typos [HttpKernel] fixed route parameters storage in the Request data collector (closes #8867) Return BC compatibility for `@Route` parameters and default values Conflicts: src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php src/Symfony/Component/Console/Application.php
2 parents 17f4a3d + 535cf50 commit 702e652

File tree

11 files changed

+43
-18
lines changed

11 files changed

+43
-18
lines changed

src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,13 @@ public function enctype(FormView $view)
146146
*
147147
* Example usage:
148148
*
149-
* <?php echo view['form']->widget($form) ?>
149+
* <?php echo $view['form']->widget($form) ?>
150150
*
151151
* You can pass options during the call:
152152
*
153-
* <?php echo view['form']->widget($form, array('attr' => array('class' => 'foo'))) ?>
153+
* <?php echo $view['form']->widget($form, array('attr' => array('class' => 'foo'))) ?>
154154
*
155-
* <?php echo view['form']->widget($form, array('separator' => '+++++')) ?>
155+
* <?php echo $view['form']->widget($form, array('separator' => '+++++')) ?>
156156
*
157157
* @param FormView $view The view for which to render the widget
158158
* @param array $variables Additional variables passed to the template

src/Symfony/Component/Console/Application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ protected function configureIO(InputInterface $input, OutputInterface $output)
861861
$input->setInteractive(false);
862862
} elseif (function_exists('posix_isatty') && $this->getHelperSet()->has('dialog')) {
863863
$inputStream = $this->getHelperSet()->get('dialog')->getInputStream();
864-
if (!posix_isatty($inputStream)) {
864+
if (!@posix_isatty($inputStream)) {
865865
$input->setInteractive(false);
866866
}
867867
}

src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,14 @@ public function collect(Request $request, Response $response, \Exception $except
5151
$attributes = array();
5252
foreach ($request->attributes->all() as $key => $value) {
5353
if ('_route' == $key && is_object($value)) {
54-
$value = $value->getPath();
54+
$attributes['_route'] = $this->varToString($value->getPath());
55+
} elseif ('_route_params' == $key) {
56+
foreach ($value as $key => $v) {
57+
$attributes['_route_params'][$key] = $this->varToString($v);
58+
}
59+
} else {
60+
$attributes[$key] = $this->varToString($value);
5561
}
56-
57-
$attributes[$key] = $this->varToString($value);
5862
}
5963

6064
$content = null;

src/Symfony/Component/HttpKernel/DataCollector/RouterDataCollector.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ public function collect(Request $request, Response $response, \Exception $except
5050
$this->data['route'] = $this->guessRoute($request, $this->controllers[$request]);
5151
}
5252
}
53+
54+
unset($this->controllers[$request]);
5355
}
5456

5557
protected function guessRoute(Request $request, $controller)

src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ public function onKernelResponse(FilterResponseEvent $event)
135135

136136
if ($master) {
137137
$this->saveProfiles($profile);
138+
139+
unset($this->children);
138140
}
139141
}
140142

src/Symfony/Component/PropertyAccess/StringUtil.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,13 @@ class StringUtil
6363
// babies (baby)
6464
array('sei', 3, false, true, 'y'),
6565

66+
// accesses (access), addresses (address), kisses (kiss)
67+
array('sess', 4, true, false, 'ss'),
68+
6669
// analyses (analysis), ellipses (ellipsis), funguses (fungus),
6770
// neuroses (neurosis), theses (thesis), emphases (emphasis),
6871
// oases (oasis), crises (crisis), houses (house), bases (base),
69-
// atlases (atlas), kisses (kiss)
72+
// atlases (atlas)
7073
array('ses', 3, true, true, array('s', 'se', 'sis')),
7174

7275
// objectives (objective), alternative (alternatives)

src/Symfony/Component/PropertyAccess/Tests/StringUtilTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ public function singularifyProvider()
7575
array('heroes', array('hero', 'heroe')),
7676
array('hoaxes', 'hoax'),
7777
array('irises', array('iris', 'irise', 'irisis')),
78-
array('kisses', array('kiss', 'kisse', 'kissis')),
78+
array('kisses', 'kiss'),
79+
array('addresses', 'address'),
80+
array('accesses', 'access'),
7981
array('knives', 'knife'),
8082
array('lives', 'life'),
8183
array('lice', 'louse'),

src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ protected function addRoute(RouteCollection $collection, $annot, $globals, \Refl
180180

181181
$defaults = array_replace($globals['defaults'], $annot->getDefaults());
182182
foreach ($method->getParameters() as $param) {
183-
if ($param->isOptional()) {
183+
if (!isset($defaults[$param->getName()]) && $param->isOptional()) {
184184
$defaults[$param->getName()] = $param->getDefaultValue();
185185
}
186186
}

src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Component\Routing\Tests\Loader;
1313

14+
use Symfony\Component\Routing\Annotation\Route;
15+
1416
class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest
1517
{
1618
protected $loader;
@@ -71,13 +73,18 @@ public function getLoadTests()
7173
return array(
7274
array(
7375
'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass',
74-
array('name'=>'route1'),
75-
array('arg2' => 'defaultValue2', 'arg3' =>'defaultValue3')
76+
array('name' => 'route1'),
77+
array('arg2' => 'defaultValue2', 'arg3' => 'defaultValue3')
7678
),
7779
array(
7880
'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass',
79-
array('name'=>'route1', 'defaults' => array('arg2' => 'foo')),
80-
array('arg2' => 'defaultValue2', 'arg3' =>'defaultValue3')
81+
array('name' => 'route1', 'defaults' => array('arg2' => 'foo')),
82+
array('arg2' => 'defaultValue2', 'arg3' => 'defaultValue3')
83+
),
84+
array(
85+
'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass',
86+
array('name' => 'route1', 'defaults' => array('arg2' => 'foobar')),
87+
array('arg2' => false, 'arg3' => 'defaultValue3')
8188
),
8289
);
8390
}
@@ -108,12 +115,11 @@ public function testLoad($className, $routeDatas = array(), $methodArgs = array(
108115
$this->assertSame($routeDatas['path'], $route->getPath(), '->load preserves path annotation');
109116
$this->assertSame($routeDatas['requirements'],$route->getRequirements(), '->load preserves requirements annotation');
110117
$this->assertCount(0, array_intersect($route->getOptions(), $routeDatas['options']), '->load preserves options annotation');
111-
$this->assertSame(array_replace($routeDatas['defaults'], $methodArgs), $route->getDefaults(), '->load preserves defaults annotation');
118+
$this->assertSame(array_replace($methodArgs, $routeDatas['defaults']), $route->getDefaults(), '->load preserves defaults annotation');
112119
}
113120

114121
private function getAnnotatedRoute($datas)
115122
{
116-
return new \Symfony\Component\Routing\Annotation\Route($datas);
123+
return new Route($datas);
117124
}
118-
119125
}

src/Symfony/Component/Security/Http/Firewall/ContextListener.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class ContextListener implements ListenerInterface
3838
private $logger;
3939
private $userProviders;
4040
private $dispatcher;
41+
private $registered;
4142

4243
public function __construct(SecurityContextInterface $context, array $userProviders, $contextKey, LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null)
4344
{
@@ -65,8 +66,9 @@ public function __construct(SecurityContextInterface $context, array $userProvid
6566
*/
6667
public function handle(GetResponseEvent $event)
6768
{
68-
if (null !== $this->dispatcher && HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) {
69+
if (!$this->registered && null !== $this->dispatcher && HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) {
6970
$this->dispatcher->addListener(KernelEvents::RESPONSE, array($this, 'onKernelResponse'));
71+
$this->registered = true;
7072
}
7173

7274
$request = $event->getRequest();

src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ public function register(EventDispatcherInterface $dispatcher)
7676
*/
7777
public function onKernelException(GetResponseForExceptionEvent $event)
7878
{
79+
// we need to remove ourselves as the exception listener can be
80+
// different depending on the Request
81+
$event->getDispatcher()->removeListener(KernelEvents::EXCEPTION, array($this, 'onKernelException'));
82+
7983
$exception = $event->getException();
8084
$request = $event->getRequest();
8185

0 commit comments

Comments
 (0)