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
This commit is contained in:
commit
702e652002
@ -146,13 +146,13 @@ class FormHelper extends Helper
|
|||||||
*
|
*
|
||||||
* Example usage:
|
* Example usage:
|
||||||
*
|
*
|
||||||
* <?php echo view['form']->widget($form) ?>
|
* <?php echo $view['form']->widget($form) ?>
|
||||||
*
|
*
|
||||||
* You can pass options during the call:
|
* You can pass options during the call:
|
||||||
*
|
*
|
||||||
* <?php echo view['form']->widget($form, array('attr' => array('class' => 'foo'))) ?>
|
* <?php echo $view['form']->widget($form, array('attr' => array('class' => 'foo'))) ?>
|
||||||
*
|
*
|
||||||
* <?php echo view['form']->widget($form, array('separator' => '+++++')) ?>
|
* <?php echo $view['form']->widget($form, array('separator' => '+++++')) ?>
|
||||||
*
|
*
|
||||||
* @param FormView $view The view for which to render the widget
|
* @param FormView $view The view for which to render the widget
|
||||||
* @param array $variables Additional variables passed to the template
|
* @param array $variables Additional variables passed to the template
|
||||||
|
@ -861,7 +861,7 @@ class Application
|
|||||||
$input->setInteractive(false);
|
$input->setInteractive(false);
|
||||||
} elseif (function_exists('posix_isatty') && $this->getHelperSet()->has('dialog')) {
|
} elseif (function_exists('posix_isatty') && $this->getHelperSet()->has('dialog')) {
|
||||||
$inputStream = $this->getHelperSet()->get('dialog')->getInputStream();
|
$inputStream = $this->getHelperSet()->get('dialog')->getInputStream();
|
||||||
if (!posix_isatty($inputStream)) {
|
if (!@posix_isatty($inputStream)) {
|
||||||
$input->setInteractive(false);
|
$input->setInteractive(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,10 +51,14 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
|||||||
$attributes = array();
|
$attributes = array();
|
||||||
foreach ($request->attributes->all() as $key => $value) {
|
foreach ($request->attributes->all() as $key => $value) {
|
||||||
if ('_route' == $key && is_object($value)) {
|
if ('_route' == $key && is_object($value)) {
|
||||||
$value = $value->getPath();
|
$attributes['_route'] = $this->varToString($value->getPath());
|
||||||
|
} elseif ('_route_params' == $key) {
|
||||||
|
foreach ($value as $key => $v) {
|
||||||
|
$attributes['_route_params'][$key] = $this->varToString($v);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$attributes[$key] = $this->varToString($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
$attributes[$key] = $this->varToString($value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = null;
|
$content = null;
|
||||||
|
@ -50,6 +50,8 @@ class RouterDataCollector extends DataCollector
|
|||||||
$this->data['route'] = $this->guessRoute($request, $this->controllers[$request]);
|
$this->data['route'] = $this->guessRoute($request, $this->controllers[$request]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unset($this->controllers[$request]);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function guessRoute(Request $request, $controller)
|
protected function guessRoute(Request $request, $controller)
|
||||||
|
@ -135,6 +135,8 @@ class ProfilerListener implements EventSubscriberInterface
|
|||||||
|
|
||||||
if ($master) {
|
if ($master) {
|
||||||
$this->saveProfiles($profile);
|
$this->saveProfiles($profile);
|
||||||
|
|
||||||
|
unset($this->children);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,10 +63,13 @@ class StringUtil
|
|||||||
// babies (baby)
|
// babies (baby)
|
||||||
array('sei', 3, false, true, 'y'),
|
array('sei', 3, false, true, 'y'),
|
||||||
|
|
||||||
|
// accesses (access), addresses (address), kisses (kiss)
|
||||||
|
array('sess', 4, true, false, 'ss'),
|
||||||
|
|
||||||
// analyses (analysis), ellipses (ellipsis), funguses (fungus),
|
// analyses (analysis), ellipses (ellipsis), funguses (fungus),
|
||||||
// neuroses (neurosis), theses (thesis), emphases (emphasis),
|
// neuroses (neurosis), theses (thesis), emphases (emphasis),
|
||||||
// oases (oasis), crises (crisis), houses (house), bases (base),
|
// oases (oasis), crises (crisis), houses (house), bases (base),
|
||||||
// atlases (atlas), kisses (kiss)
|
// atlases (atlas)
|
||||||
array('ses', 3, true, true, array('s', 'se', 'sis')),
|
array('ses', 3, true, true, array('s', 'se', 'sis')),
|
||||||
|
|
||||||
// objectives (objective), alternative (alternatives)
|
// objectives (objective), alternative (alternatives)
|
||||||
|
@ -75,7 +75,9 @@ class StringUtilTest extends \PHPUnit_Framework_TestCase
|
|||||||
array('heroes', array('hero', 'heroe')),
|
array('heroes', array('hero', 'heroe')),
|
||||||
array('hoaxes', 'hoax'),
|
array('hoaxes', 'hoax'),
|
||||||
array('irises', array('iris', 'irise', 'irisis')),
|
array('irises', array('iris', 'irise', 'irisis')),
|
||||||
array('kisses', array('kiss', 'kisse', 'kissis')),
|
array('kisses', 'kiss'),
|
||||||
|
array('addresses', 'address'),
|
||||||
|
array('accesses', 'access'),
|
||||||
array('knives', 'knife'),
|
array('knives', 'knife'),
|
||||||
array('lives', 'life'),
|
array('lives', 'life'),
|
||||||
array('lice', 'louse'),
|
array('lice', 'louse'),
|
||||||
|
@ -180,7 +180,7 @@ abstract class AnnotationClassLoader implements LoaderInterface
|
|||||||
|
|
||||||
$defaults = array_replace($globals['defaults'], $annot->getDefaults());
|
$defaults = array_replace($globals['defaults'], $annot->getDefaults());
|
||||||
foreach ($method->getParameters() as $param) {
|
foreach ($method->getParameters() as $param) {
|
||||||
if ($param->isOptional()) {
|
if (!isset($defaults[$param->getName()]) && $param->isOptional()) {
|
||||||
$defaults[$param->getName()] = $param->getDefaultValue();
|
$defaults[$param->getName()] = $param->getDefaultValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Routing\Tests\Loader;
|
namespace Symfony\Component\Routing\Tests\Loader;
|
||||||
|
|
||||||
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
||||||
class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest
|
class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest
|
||||||
{
|
{
|
||||||
protected $loader;
|
protected $loader;
|
||||||
@ -71,13 +73,18 @@ class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest
|
|||||||
return array(
|
return array(
|
||||||
array(
|
array(
|
||||||
'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass',
|
'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass',
|
||||||
array('name'=>'route1'),
|
array('name' => 'route1'),
|
||||||
array('arg2' => 'defaultValue2', 'arg3' =>'defaultValue3')
|
array('arg2' => 'defaultValue2', 'arg3' => 'defaultValue3')
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass',
|
'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass',
|
||||||
array('name'=>'route1', 'defaults' => array('arg2' => 'foo')),
|
array('name' => 'route1', 'defaults' => array('arg2' => 'foo')),
|
||||||
array('arg2' => 'defaultValue2', 'arg3' =>'defaultValue3')
|
array('arg2' => 'defaultValue2', 'arg3' => 'defaultValue3')
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass',
|
||||||
|
array('name' => 'route1', 'defaults' => array('arg2' => 'foobar')),
|
||||||
|
array('arg2' => false, 'arg3' => 'defaultValue3')
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -108,12 +115,11 @@ class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest
|
|||||||
$this->assertSame($routeDatas['path'], $route->getPath(), '->load preserves path annotation');
|
$this->assertSame($routeDatas['path'], $route->getPath(), '->load preserves path annotation');
|
||||||
$this->assertSame($routeDatas['requirements'],$route->getRequirements(), '->load preserves requirements annotation');
|
$this->assertSame($routeDatas['requirements'],$route->getRequirements(), '->load preserves requirements annotation');
|
||||||
$this->assertCount(0, array_intersect($route->getOptions(), $routeDatas['options']), '->load preserves options annotation');
|
$this->assertCount(0, array_intersect($route->getOptions(), $routeDatas['options']), '->load preserves options annotation');
|
||||||
$this->assertSame(array_replace($routeDatas['defaults'], $methodArgs), $route->getDefaults(), '->load preserves defaults annotation');
|
$this->assertSame(array_replace($methodArgs, $routeDatas['defaults']), $route->getDefaults(), '->load preserves defaults annotation');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getAnnotatedRoute($datas)
|
private function getAnnotatedRoute($datas)
|
||||||
{
|
{
|
||||||
return new \Symfony\Component\Routing\Annotation\Route($datas);
|
return new Route($datas);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ class ContextListener implements ListenerInterface
|
|||||||
private $logger;
|
private $logger;
|
||||||
private $userProviders;
|
private $userProviders;
|
||||||
private $dispatcher;
|
private $dispatcher;
|
||||||
|
private $registered;
|
||||||
|
|
||||||
public function __construct(SecurityContextInterface $context, array $userProviders, $contextKey, LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null)
|
public function __construct(SecurityContextInterface $context, array $userProviders, $contextKey, LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null)
|
||||||
{
|
{
|
||||||
@ -65,8 +66,9 @@ class ContextListener implements ListenerInterface
|
|||||||
*/
|
*/
|
||||||
public function handle(GetResponseEvent $event)
|
public function handle(GetResponseEvent $event)
|
||||||
{
|
{
|
||||||
if (null !== $this->dispatcher && HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) {
|
if (!$this->registered && null !== $this->dispatcher && HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) {
|
||||||
$this->dispatcher->addListener(KernelEvents::RESPONSE, array($this, 'onKernelResponse'));
|
$this->dispatcher->addListener(KernelEvents::RESPONSE, array($this, 'onKernelResponse'));
|
||||||
|
$this->registered = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$request = $event->getRequest();
|
$request = $event->getRequest();
|
||||||
|
@ -76,6 +76,10 @@ class ExceptionListener
|
|||||||
*/
|
*/
|
||||||
public function onKernelException(GetResponseForExceptionEvent $event)
|
public function onKernelException(GetResponseForExceptionEvent $event)
|
||||||
{
|
{
|
||||||
|
// we need to remove ourselves as the exception listener can be
|
||||||
|
// different depending on the Request
|
||||||
|
$event->getDispatcher()->removeListener(KernelEvents::EXCEPTION, array($this, 'onKernelException'));
|
||||||
|
|
||||||
$exception = $event->getException();
|
$exception = $event->getException();
|
||||||
$request = $event->getRequest();
|
$request = $event->getRequest();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user