From b71d589071aa91e7d761032a4faf4727849da4e7 Mon Sep 17 00:00:00 2001 From: Bill Hance Date: Wed, 24 Apr 2019 00:12:49 -0700 Subject: [PATCH 1/5] Added FormInterface to @return Form::getClickedButton docblock --- src/Symfony/Component/Form/Form.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php index 5f417d6d90..3e8d632d93 100644 --- a/src/Symfony/Component/Form/Form.php +++ b/src/Symfony/Component/Form/Form.php @@ -89,7 +89,7 @@ class Form implements \IteratorAggregate, FormInterface private $submitted = false; /** - * @var ClickableInterface|null The button that was used to submit the form + * @var FormInterface|ClickableInterface|null The button that was used to submit the form */ private $clickedButton; @@ -749,7 +749,7 @@ class Form implements \IteratorAggregate, FormInterface /** * Returns the button that was used to submit the form. * - * @return ClickableInterface|null + * @return FormInterface|ClickableInterface|null */ public function getClickedButton() { From 48093f4a13cf42540356442f53ebfa6c309630bc Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sun, 9 Jun 2019 16:27:26 +0200 Subject: [PATCH 2/5] Fix reporting unsilenced deprecations from insulated tests --- .../Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php | 3 ++- src/Symfony/Component/BrowserKit/Client.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php b/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php index 2c7391a00b..481a860aab 100644 --- a/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php +++ b/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php @@ -284,7 +284,8 @@ class SymfonyTestsListenerTrait foreach ($deprecations ? unserialize($deprecations) : array() as $deprecation) { $error = serialize(array('deprecation' => $deprecation[1], 'class' => $className, 'method' => $test->getName(false), 'triggering_file' => isset($deprecation[2]) ? $deprecation[2] : null)); if ($deprecation[0]) { - @trigger_error($error, E_USER_DEPRECATED); + // unsilenced on purpose + trigger_error($error, E_USER_DEPRECATED); } else { @trigger_error($error, E_USER_DEPRECATED); } diff --git a/src/Symfony/Component/BrowserKit/Client.php b/src/Symfony/Component/BrowserKit/Client.php index 98553353d8..6c3bcc1663 100644 --- a/src/Symfony/Component/BrowserKit/Client.php +++ b/src/Symfony/Component/BrowserKit/Client.php @@ -361,7 +361,8 @@ abstract class Client unlink($deprecationsFile); foreach ($deprecations ? unserialize($deprecations) : [] as $deprecation) { if ($deprecation[0]) { - @trigger_error($deprecation[1], E_USER_DEPRECATED); + // unsilenced on purpose + trigger_error($deprecation[1], E_USER_DEPRECATED); } else { @trigger_error($deprecation[1], E_USER_DEPRECATED); } From 9ad324ba2979fba6481dfc76258b8872a684ad0a Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sun, 9 Jun 2019 16:44:28 +0200 Subject: [PATCH 3/5] [Form] test case is not legacy --- .../Form/Tests/Extension/Core/Type/ChoiceTypeTest.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php index 4a7f006f6f..bb7cc0ca7f 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php @@ -725,10 +725,7 @@ class ChoiceTypeTest extends BaseTypeTest $this->assertSame(['test'], $form->getData()); } - /** - * @group legacy - */ - public function testLegacyNullChoices() + public function testNullChoices() { $form = $this->factory->create(static::TESTED_TYPE, null, [ 'multiple' => false, From adc7e6ab7cd70f9faaec5b2ab6cf1dd9b350f0eb Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sat, 8 Jun 2019 10:05:38 +0200 Subject: [PATCH 4/5] [OptionsResolver] fix adding $triggerDeprecation to Options::offsetGet() --- src/Symfony/Component/OptionsResolver/Options.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Symfony/Component/OptionsResolver/Options.php b/src/Symfony/Component/OptionsResolver/Options.php index d18374cb91..d444ec4230 100644 --- a/src/Symfony/Component/OptionsResolver/Options.php +++ b/src/Symfony/Component/OptionsResolver/Options.php @@ -16,8 +16,6 @@ namespace Symfony\Component\OptionsResolver; * * @author Bernhard Schussek * @author Tobias Schultze - * - * @method mixed offsetGet(string $option, bool $triggerDeprecation = true) */ interface Options extends \ArrayAccess, \Countable { From 1872a5af3940fa94a3cd404f17ad36bf9a4d5a21 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sun, 9 Jun 2019 18:36:33 +0200 Subject: [PATCH 5/5] [WebProfilerBundle] fix FC with HttpFoundation v5 --- .../Controller/ProfilerController.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php index d798c03214..8021451601 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php @@ -140,9 +140,7 @@ class ProfilerController throw new NotFoundHttpException('The profiler must be enabled.'); } - $session = $request->getSession(); - - if (null !== $session && $session->isStarted() && $session->getFlashBag() instanceof AutoExpireFlashBag) { + if ($request->hasSession() && ($session = $request->getSession()) && $session->isStarted() && $session->getFlashBag() instanceof AutoExpireFlashBag) { // keep current flashes for one more request if using AutoExpireFlashBag $session->getFlashBag()->setAll($session->getFlashBag()->peekAll()); } @@ -199,7 +197,7 @@ class ProfilerController $this->cspHandler->disableCsp(); } - if (null === $session = $request->getSession()) { + if (!$request->hasSession()) { $ip = $method = $statusCode = @@ -209,6 +207,8 @@ class ProfilerController $limit = $token = null; } else { + $session = $request->getSession(); + $ip = $request->query->get('ip', $session->get('_profiler_search_ip')); $method = $request->query->get('method', $session->get('_profiler_search_method')); $statusCode = $request->query->get('status_code', $session->get('_profiler_search_status_code')); @@ -308,7 +308,9 @@ class ProfilerController $limit = $request->query->get('limit'); $token = $request->query->get('token'); - if (null !== $session = $request->getSession()) { + if ($request->hasSession()) { + $session = $request->getSession(); + $session->set('_profiler_search_ip', $ip); $session->set('_profiler_search_method', $method); $session->set('_profiler_search_status_code', $statusCode);