From 5013f9895f621b72798b0dd0d951e2a319e78df9 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 26 Nov 2015 07:58:58 +0100 Subject: [PATCH 1/6] [HttpFoundation] Workaround HHVM rewriting HTTP response line --- src/Symfony/Component/HttpFoundation/Response.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php index ad55f8772a..914e54fbb3 100644 --- a/src/Symfony/Component/HttpFoundation/Response.php +++ b/src/Symfony/Component/HttpFoundation/Response.php @@ -268,9 +268,6 @@ class Response return $this; } - // status - header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText)); - // headers foreach ($this->headers->allPreserveCase() as $name => $values) { foreach ($values as $value) { @@ -278,6 +275,9 @@ class Response } } + // status + header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText), true, $this->statusCode); + // cookies foreach ($this->headers->getCookies() as $cookie) { setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly()); From f495410d25e0ce7c2bf503be91b1776b4e2359ff Mon Sep 17 00:00:00 2001 From: Bernhard Schussek Date: Thu, 26 Nov 2015 10:11:54 +0100 Subject: [PATCH 2/6] [Form] Disabled view data validation if "data_class" is set to null --- src/Symfony/Component/Form/Form.php | 18 ++++-------------- .../Component/Form/Tests/SimpleFormTest.php | 10 +++++----- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php index a277b580c5..0f68dc851a 100644 --- a/src/Symfony/Component/Form/Form.php +++ b/src/Symfony/Component/Form/Form.php @@ -356,21 +356,11 @@ class Form implements \IteratorAggregate, FormInterface if (!FormUtil::isEmpty($viewData)) { $dataClass = $this->config->getDataClass(); - $actualType = is_object($viewData) ? 'an instance of class '.get_class($viewData) : 'a(n) '.gettype($viewData); - - if (null === $dataClass && is_object($viewData) && !$viewData instanceof \ArrayAccess) { - $expectedType = 'scalar, array or an instance of \ArrayAccess'; - - throw new LogicException( - 'The form\'s view data is expected to be of type '.$expectedType.', '. - 'but is '.$actualType.'. You '. - 'can avoid this error by setting the "data_class" option to '. - '"'.get_class($viewData).'" or by adding a view transformer '. - 'that transforms '.$actualType.' to '.$expectedType.'.' - ); - } - if (null !== $dataClass && !$viewData instanceof $dataClass) { + $actualType = is_object($viewData) + ? 'an instance of class '.get_class($viewData) + : 'a(n) '.gettype($viewData); + throw new LogicException( 'The form\'s view data is expected to be an instance of class '. $dataClass.', but is '.$actualType.'. You can avoid this error '. diff --git a/src/Symfony/Component/Form/Tests/SimpleFormTest.php b/src/Symfony/Component/Form/Tests/SimpleFormTest.php index 6fb24a8cdc..ae174f045d 100644 --- a/src/Symfony/Component/Form/Tests/SimpleFormTest.php +++ b/src/Symfony/Component/Form/Tests/SimpleFormTest.php @@ -840,19 +840,19 @@ class SimpleFormTest extends AbstractFormTest $this->assertEquals(new PropertyPath('[name]'), $form->getPropertyPath()); } - /** - * @expectedException \Symfony\Component\Form\Exception\LogicException - */ - public function testViewDataMustNotBeObjectIfDataClassIsNull() + public function testViewDataMayBeObjectIfDataClassIsNull() { + $object = new \stdClass(); $config = new FormConfigBuilder('name', null, $this->dispatcher); $config->addViewTransformer(new FixedDataTransformer(array( '' => '', - 'foo' => new \stdClass(), + 'foo' => $object, ))); $form = new Form($config); $form->setData('foo'); + + $this->assertSame($object, $form->getViewData()); } public function testViewDataMayBeArrayAccessIfDataClassIsNull() From 478375d66424edfe8c9b40cd7f36ed784fba3b62 Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Thu, 26 Nov 2015 18:53:25 +0100 Subject: [PATCH 3/6] [DI] remove useless condition around unset --- src/Symfony/Component/DependencyInjection/Container.php | 5 +---- src/Symfony/Component/DependencyInjection/Definition.php | 4 +--- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index 443a65fb41..fb0e31911b 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -312,10 +312,7 @@ class Container implements IntrospectableContainerInterface $service = $this->$method(); } catch (\Exception $e) { unset($this->loading[$id]); - - if (array_key_exists($id, $this->services)) { - unset($this->services[$id]); - } + unset($this->services[$id]); if ($e instanceof InactiveScopeException && self::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) { return; diff --git a/src/Symfony/Component/DependencyInjection/Definition.php b/src/Symfony/Component/DependencyInjection/Definition.php index e2b40ff4b9..690daa9c6a 100644 --- a/src/Symfony/Component/DependencyInjection/Definition.php +++ b/src/Symfony/Component/DependencyInjection/Definition.php @@ -409,9 +409,7 @@ class Definition */ public function clearTag($name) { - if (isset($this->tags[$name])) { - unset($this->tags[$name]); - } + unset($this->tags[$name]); return $this; } From 55f84a3369091e4fcf718472952a6bcb689c491c Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Thu, 26 Nov 2015 20:19:29 +0100 Subject: [PATCH 4/6] [SecurityBundle] disable the init:acl command if ACL is not used --- .../Bundle/SecurityBundle/Command/InitAclCommand.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php b/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php index fff5b1e929..14271dc459 100644 --- a/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php +++ b/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php @@ -23,6 +23,18 @@ use Doctrine\DBAL\Schema\SchemaException; */ class InitAclCommand extends ContainerAwareCommand { + /** + * {@inheritdoc} + */ + public function isEnabled() + { + if (!$this->getContainer()->has('security.acl.dbal.connection')) { + return false; + } + + return parent::isEnabled(); + } + /** * {@inheritdoc} */ From 123a300ad72d77f9d8e34a3ab44449b47be0eb49 Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Wed, 25 Nov 2015 14:52:03 +0100 Subject: [PATCH 5/6] [Debug] fix readme: DebugClassLoader moved to debug itself --- src/Symfony/Component/Debug/README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Debug/README.md b/src/Symfony/Component/Debug/README.md index 67e6d6c278..82c6e30322 100644 --- a/src/Symfony/Component/Debug/README.md +++ b/src/Symfony/Component/Debug/README.md @@ -15,6 +15,7 @@ Debug::enable(); You can also use the tools individually: ```php +use Symfony\Component\Debug\DebugClassLoader; use Symfony\Component\Debug\ErrorHandler; use Symfony\Component\Debug\ExceptionHandler; @@ -25,11 +26,9 @@ if ('cli' !== php_sapi_name()) { ini_set('display_errors', 1); } ErrorHandler::register(); +DebugClassLoader::enable(); ``` -Note that the `Debug::enable()` call also registers the debug class loader -from the Symfony ClassLoader component when available. - This component can optionally take advantage of the features of the HttpKernel and HttpFoundation components. From 90f3b941d34d9c868bc21a096f96045207e493df Mon Sep 17 00:00:00 2001 From: hainey Date: Fri, 27 Nov 2015 13:33:49 +0900 Subject: [PATCH 6/6] Fixed the wrong source name and the ja translation --- .../Component/Form/Resources/translations/validators.ja.xlf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Form/Resources/translations/validators.ja.xlf b/src/Symfony/Component/Form/Resources/translations/validators.ja.xlf index 2e8585a75c..0db5eddbe6 100644 --- a/src/Symfony/Component/Form/Resources/translations/validators.ja.xlf +++ b/src/Symfony/Component/Form/Resources/translations/validators.ja.xlf @@ -11,8 +11,8 @@ アップロードされたファイルが大きすぎます。小さなファイルで再度アップロードしてください。 - The CSRF token is invalid. - CSRFトークンが無効です。 + The CSRF token is invalid. Please try to resubmit the form. + CSRFトークンが無効です、再送信してください。