From c3eecb591df221cc8851217bccc3053d20902a11 Mon Sep 17 00:00:00 2001 From: Baptiste Dupuch Date: Mon, 13 Apr 2015 12:57:04 +0200 Subject: [PATCH 01/11] Add better phpdoc message for getListeners method of the EventDispatcher --- .../Component/EventDispatcher/EventDispatcherInterface.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/EventDispatcher/EventDispatcherInterface.php b/src/Symfony/Component/EventDispatcher/EventDispatcherInterface.php index efb7c5beca..9d9fc4d44c 100644 --- a/src/Symfony/Component/EventDispatcher/EventDispatcherInterface.php +++ b/src/Symfony/Component/EventDispatcher/EventDispatcherInterface.php @@ -77,7 +77,7 @@ interface EventDispatcherInterface public function removeSubscriber(EventSubscriberInterface $subscriber); /** - * Gets the listeners of a specific event or all listeners. + * Gets the listeners of a specific event or all listeners sorted by descending priority. * * @param string $eventName The name of the event * From aca1f288435415afbf24cd252cfcf1380728e243 Mon Sep 17 00:00:00 2001 From: Alexander Schwenn Date: Sat, 18 Apr 2015 23:27:35 +0200 Subject: [PATCH 02/11] [FrameworkBundle] Check for 'xlf' instead of 'xliff' There is no translation writer format named 'xliff', but 'xlf' only. So the TranslationUpdateCommand can't be called with 'output-format' == 'xliff' and the version info will never be shown. --- .../Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php index 8477b120a4..6a9b37227b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php @@ -125,7 +125,7 @@ EOF } } - if ($input->getOption('output-format') == 'xliff') { + if ($input->getOption('output-format') == 'xlf') { $output->writeln('Xliff output version is 1.2'); } } From 1233baa66987002380e482bb969af12a3b38821d Mon Sep 17 00:00:00 2001 From: Dariusz Ruminski Date: Tue, 21 Apr 2015 22:51:01 +0200 Subject: [PATCH 03/11] CS: unalign => --- .../Bundle/FrameworkBundle/Translation/PhpStringTokenParser.php | 2 +- .../SecurityBundle/Tests/Functional/FirewallEntryPointTest.php | 2 +- .../Session/Storage/Handler/MongoDbSessionHandler.php | 2 +- .../Component/Validator/Tests/ConstraintViolationTest.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Translation/PhpStringTokenParser.php b/src/Symfony/Bundle/FrameworkBundle/Translation/PhpStringTokenParser.php index 3b899131dd..40722c0433 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Translation/PhpStringTokenParser.php +++ b/src/Symfony/Bundle/FrameworkBundle/Translation/PhpStringTokenParser.php @@ -51,7 +51,7 @@ class PhpStringTokenParser { protected static $replacements = array( '\\' => '\\', - '$' => '$', + '$' => '$', 'n' => "\n", 'r' => "\r", 't' => "\t", diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FirewallEntryPointTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FirewallEntryPointTest.php index 269cea3b72..aab98f273f 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FirewallEntryPointTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FirewallEntryPointTest.php @@ -22,7 +22,7 @@ class FirewallEntryPointTest extends WebTestCase $client->request('GET', '/secure/resource', array(), array(), array( 'PHP_AUTH_USER' => 'unknown', - 'PHP_AUTH_PW' => 'credentials', + 'PHP_AUTH_PW' => 'credentials', )); $this->assertEquals( diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php index 3876434ebe..cadef07aba 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php @@ -155,7 +155,7 @@ class MongoDbSessionHandler implements \SessionHandlerInterface public function read($sessionId) { $dbData = $this->getCollection()->findOne(array( - $this->options['id_field'] => $sessionId, + $this->options['id_field'] => $sessionId, $this->options['expiry_field'] => array('$gte' => new \MongoDate()), )); diff --git a/src/Symfony/Component/Validator/Tests/ConstraintViolationTest.php b/src/Symfony/Component/Validator/Tests/ConstraintViolationTest.php index 2ceb0169a1..dffc3840c9 100644 --- a/src/Symfony/Component/Validator/Tests/ConstraintViolationTest.php +++ b/src/Symfony/Component/Validator/Tests/ConstraintViolationTest.php @@ -40,7 +40,7 @@ EOF; '42 cannot be used here', 'this is the message template', array(), - array('some_value' => 42), + array('some_value' => 42), 'some_value', null ); From 34e000e59a3712ae57d16b116acac147d44cdbf9 Mon Sep 17 00:00:00 2001 From: Diego Saint Esteben Date: Tue, 21 Apr 2015 22:28:59 -0300 Subject: [PATCH 04/11] Show a better error when the port is in use --- .../Command/ServerRunCommand.php | 38 ++++++++++++++++--- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php index 462ff09ca5..78468a5b7e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php @@ -95,16 +95,29 @@ EOF } $env = $this->getContainer()->getParameter('kernel.environment'); + $address = $input->getArgument('address'); + + if (false === strpos($address, ':')) { + $output->writeln('The address has to be of the form bind-address:port.'); + + return 1; + } + + if ($this->isOtherServerProcessRunning($address)) { + $output->writeln(sprintf('A process is already listening on http://%s.', $address)); + + return 1; + } if ('prod' === $env) { $output->writeln('Running PHP built-in server in production environment is NOT recommended!'); } - if (null === $builder = $this->createPhpProcessBuilder($input, $output, $env)) { + if (null === $builder = $this->createPhpProcessBuilder($output, $address, $input->getOption('router'), $env)) { return 1; } - $output->writeln(sprintf("Server running on http://%s\n", $input->getArgument('address'))); + $output->writeln(sprintf("Server running on http://%s\n", $address)); $output->writeln('Quit the server with CONTROL-C.'); $builder->setWorkingDirectory($documentRoot); @@ -127,9 +140,24 @@ EOF return $process->getExitCode(); } - private function createPhpProcessBuilder(InputInterface $input, OutputInterface $output, $env) + private function isOtherServerProcessRunning($address) { - $router = $input->getOption('router') ?: $this + list($hostname, $port) = explode(':', $address); + + $fp = @fsockopen($hostname, $port, $errno, $errstr, 5); + + if (false !== $fp) { + fclose($fp); + + return true; + } + + return false; + } + + private function createPhpProcessBuilder(OutputInterface $output, $address, $router, $env) + { + $router = $router ?: $this ->getContainer() ->get('kernel') ->locateResource(sprintf('@FrameworkBundle/Resources/config/router_%s.php', $env)) @@ -150,6 +178,6 @@ EOF return; } - return new ProcessBuilder(array($binary, '-S', $input->getArgument('address'), $router)); + return new ProcessBuilder(array($binary, '-S', $address, $router)); } } From d5742c18b0f80e67669876eb3867f2f1dee9cbb4 Mon Sep 17 00:00:00 2001 From: Dariusz Ruminski Date: Wed, 22 Apr 2015 09:13:42 +0200 Subject: [PATCH 05/11] CS: unalign = --- .../RememberMe/DoctrineTokenProvider.php | 2 +- .../Twig/TokenParser/TransChoiceTokenParser.php | 2 +- .../Bridge/Twig/TokenParser/TransTokenParser.php | 2 +- .../Bundle/TwigBundle/Command/LintCommand.php | 2 +- src/Symfony/Component/HttpKernel/UriSigner.php | 16 ++++++++-------- src/Symfony/Component/Process/ProcessUtils.php | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php b/src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php index feb170cb72..d078fea14e 100644 --- a/src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php +++ b/src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php @@ -95,7 +95,7 @@ class DoctrineTokenProvider implements TokenProviderInterface $paramValues = array('value' => $tokenValue, 'lastUsed' => $lastUsed, 'series' => $series,); - $paramTypes = array('value' => \PDO::PARAM_STR, + $paramTypes = array('value' => \PDO::PARAM_STR, 'lastUsed' => DoctrineType::DATETIME, 'series' => \PDO::PARAM_STR,); $updated = $this->conn->executeUpdate($sql, $paramValues, $paramTypes); diff --git a/src/Symfony/Bridge/Twig/TokenParser/TransChoiceTokenParser.php b/src/Symfony/Bridge/Twig/TokenParser/TransChoiceTokenParser.php index 1c75d8bb85..e4757d8b9d 100644 --- a/src/Symfony/Bridge/Twig/TokenParser/TransChoiceTokenParser.php +++ b/src/Symfony/Bridge/Twig/TokenParser/TransChoiceTokenParser.php @@ -56,7 +56,7 @@ class TransChoiceTokenParser extends TransTokenParser if ($stream->test('into')) { // {% transchoice count into "fr" %} $stream->next(); - $locale = $this->parser->getExpressionParser()->parseExpression(); + $locale = $this->parser->getExpressionParser()->parseExpression(); } $stream->expect(\Twig_Token::BLOCK_END_TYPE); diff --git a/src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php b/src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php index 86f9579cf6..96e420e5ce 100644 --- a/src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php +++ b/src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php @@ -53,7 +53,7 @@ class TransTokenParser extends \Twig_TokenParser if ($stream->test('into')) { // {% trans into "fr" %} $stream->next(); - $locale = $this->parser->getExpressionParser()->parseExpression(); + $locale = $this->parser->getExpressionParser()->parseExpression(); } elseif (!$stream->test(\Twig_Token::BLOCK_END_TYPE)) { throw new \Twig_Error_Syntax('Unexpected token. Twig was looking for the "with", "from", or "into" keyword.', $stream->getCurrent()->getLine(), $stream->getFilename()); } diff --git a/src/Symfony/Bundle/TwigBundle/Command/LintCommand.php b/src/Symfony/Bundle/TwigBundle/Command/LintCommand.php index 308d53b54e..88cbf90401 100644 --- a/src/Symfony/Bundle/TwigBundle/Command/LintCommand.php +++ b/src/Symfony/Bundle/TwigBundle/Command/LintCommand.php @@ -110,7 +110,7 @@ EOF protected function renderException(OutputInterface $output, $template, \Twig_Error $exception, $file = null) { - $line = $exception->getTemplateLine(); + $line = $exception->getTemplateLine(); $lines = $this->getContext($template, $line); if ($file) { diff --git a/src/Symfony/Component/HttpKernel/UriSigner.php b/src/Symfony/Component/HttpKernel/UriSigner.php index 0f49487f05..d77d27430d 100644 --- a/src/Symfony/Component/HttpKernel/UriSigner.php +++ b/src/Symfony/Component/HttpKernel/UriSigner.php @@ -94,14 +94,14 @@ class UriSigner ksort($params); $url['query'] = http_build_query($params); - $scheme = isset($url['scheme']) ? $url['scheme'].'://' : ''; - $host = isset($url['host']) ? $url['host'] : ''; - $port = isset($url['port']) ? ':'.$url['port'] : ''; - $user = isset($url['user']) ? $url['user'] : ''; - $pass = isset($url['pass']) ? ':'.$url['pass'] : ''; - $pass = ($user || $pass) ? "$pass@" : ''; - $path = isset($url['path']) ? $url['path'] : ''; - $query = isset($url['query']) && $url['query'] ? '?'.$url['query'] : ''; + $scheme = isset($url['scheme']) ? $url['scheme'].'://' : ''; + $host = isset($url['host']) ? $url['host'] : ''; + $port = isset($url['port']) ? ':'.$url['port'] : ''; + $user = isset($url['user']) ? $url['user'] : ''; + $pass = isset($url['pass']) ? ':'.$url['pass'] : ''; + $pass = ($user || $pass) ? "$pass@" : ''; + $path = isset($url['path']) ? $url['path'] : ''; + $query = isset($url['query']) && $url['query'] ? '?'.$url['query'] : ''; $fragment = isset($url['fragment']) ? '#'.$url['fragment'] : ''; return $scheme.$user.$pass.$host.$port.$path.$query.$fragment; diff --git a/src/Symfony/Component/Process/ProcessUtils.php b/src/Symfony/Component/Process/ProcessUtils.php index 748de2371a..ed3dc35032 100644 --- a/src/Symfony/Component/Process/ProcessUtils.php +++ b/src/Symfony/Component/Process/ProcessUtils.php @@ -48,7 +48,7 @@ class ProcessUtils } $escapedArgument = ''; - $quote = false; + $quote = false; foreach (preg_split('/(")/i', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) { if ('"' === $part) { $escapedArgument .= '\\"'; From c3bd418483716f397274d771d2bf30ca89c1371c Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 11 Apr 2015 12:32:53 +0200 Subject: [PATCH 06/11] improved exception when missing required component --- .../Component/Translation/Dumper/YamlFileDumper.php | 4 ++++ .../Component/Translation/Loader/CsvFileLoader.php | 5 ++++- .../Component/Translation/Loader/IcuDatFileLoader.php | 5 ++++- .../Component/Translation/Loader/IcuResFileLoader.php | 5 ++++- .../Component/Translation/Loader/IniFileLoader.php | 5 ++++- .../Component/Translation/Loader/MoFileLoader.php | 5 ++++- .../Component/Translation/Loader/PhpFileLoader.php | 5 ++++- .../Component/Translation/Loader/PoFileLoader.php | 5 ++++- .../Component/Translation/Loader/QtFileLoader.php | 5 ++++- .../Component/Translation/Loader/XliffFileLoader.php | 5 ++++- .../Component/Translation/Loader/YamlFileLoader.php | 9 ++++++++- 11 files changed, 48 insertions(+), 10 deletions(-) diff --git a/src/Symfony/Component/Translation/Dumper/YamlFileDumper.php b/src/Symfony/Component/Translation/Dumper/YamlFileDumper.php index 5920fef20c..870fb98380 100644 --- a/src/Symfony/Component/Translation/Dumper/YamlFileDumper.php +++ b/src/Symfony/Component/Translation/Dumper/YamlFileDumper.php @@ -26,6 +26,10 @@ class YamlFileDumper extends FileDumper */ protected function format(MessageCatalogue $messages, $domain) { + if (!class_exists('Symfony\Component\Yaml\Yaml')) { + throw new \LogicException('Dumping translations in the YAML format requires the Symfony Yaml component.'); + } + return Yaml::dump($messages->all($domain)); } diff --git a/src/Symfony/Component/Translation/Loader/CsvFileLoader.php b/src/Symfony/Component/Translation/Loader/CsvFileLoader.php index ddcf595baf..fc927601d9 100644 --- a/src/Symfony/Component/Translation/Loader/CsvFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/CsvFileLoader.php @@ -71,7 +71,10 @@ class CsvFileLoader extends ArrayLoader } $catalogue = parent::load($messages, $locale, $domain); - $catalogue->addResource(new FileResource($resource)); + + if (class_exists('Symfony\Component\Config\Resource\FileResource')) { + $catalogue->addResource(new FileResource($resource)); + } return $catalogue; } diff --git a/src/Symfony/Component/Translation/Loader/IcuDatFileLoader.php b/src/Symfony/Component/Translation/Loader/IcuDatFileLoader.php index a36cd76e71..71ba90a39d 100644 --- a/src/Symfony/Component/Translation/Loader/IcuDatFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/IcuDatFileLoader.php @@ -52,7 +52,10 @@ class IcuDatFileLoader extends IcuResFileLoader $messages = $this->flatten($rb); $catalogue = new MessageCatalogue($locale); $catalogue->add($messages, $domain); - $catalogue->addResource(new FileResource($resource.'.dat')); + + if (class_exists('Symfony\Component\Config\Resource\FileResource')) { + $catalogue->addResource(new FileResource($resource.'.dat')); + } return $catalogue; } diff --git a/src/Symfony/Component/Translation/Loader/IcuResFileLoader.php b/src/Symfony/Component/Translation/Loader/IcuResFileLoader.php index d864c7bd0c..2f8037fb16 100644 --- a/src/Symfony/Component/Translation/Loader/IcuResFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/IcuResFileLoader.php @@ -52,7 +52,10 @@ class IcuResFileLoader implements LoaderInterface $messages = $this->flatten($rb); $catalogue = new MessageCatalogue($locale); $catalogue->add($messages, $domain); - $catalogue->addResource(new DirectoryResource($resource)); + + if (class_exists('Symfony\Component\Config\Resource\DirectoryResource')) { + $catalogue->addResource(new DirectoryResource($resource)); + } return $catalogue; } diff --git a/src/Symfony/Component/Translation/Loader/IniFileLoader.php b/src/Symfony/Component/Translation/Loader/IniFileLoader.php index 3f01ab4e99..1b3a7b1911 100644 --- a/src/Symfony/Component/Translation/Loader/IniFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/IniFileLoader.php @@ -38,7 +38,10 @@ class IniFileLoader extends ArrayLoader $messages = parse_ini_file($resource, true); $catalogue = parent::load($messages, $locale, $domain); - $catalogue->addResource(new FileResource($resource)); + + if (class_exists('Symfony\Component\Config\Resource\FileResource')) { + $catalogue->addResource(new FileResource($resource)); + } return $catalogue; } diff --git a/src/Symfony/Component/Translation/Loader/MoFileLoader.php b/src/Symfony/Component/Translation/Loader/MoFileLoader.php index 9cab3f0d8d..ab4e7a9574 100644 --- a/src/Symfony/Component/Translation/Loader/MoFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/MoFileLoader.php @@ -66,7 +66,10 @@ class MoFileLoader extends ArrayLoader } $catalogue = parent::load($messages, $locale, $domain); - $catalogue->addResource(new FileResource($resource)); + + if (class_exists('Symfony\Component\Config\Resource\FileResource')) { + $catalogue->addResource(new FileResource($resource)); + } return $catalogue; } diff --git a/src/Symfony/Component/Translation/Loader/PhpFileLoader.php b/src/Symfony/Component/Translation/Loader/PhpFileLoader.php index 1cc9d06d9c..9ce2e7d2fa 100644 --- a/src/Symfony/Component/Translation/Loader/PhpFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/PhpFileLoader.php @@ -42,7 +42,10 @@ class PhpFileLoader extends ArrayLoader $messages = require $resource; $catalogue = parent::load($messages, $locale, $domain); - $catalogue->addResource(new FileResource($resource)); + + if (class_exists('Symfony\Component\Config\Resource\FileResource')) { + $catalogue->addResource(new FileResource($resource)); + } return $catalogue; } diff --git a/src/Symfony/Component/Translation/Loader/PoFileLoader.php b/src/Symfony/Component/Translation/Loader/PoFileLoader.php index 8c8f1a297a..b5d12e9821 100644 --- a/src/Symfony/Component/Translation/Loader/PoFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/PoFileLoader.php @@ -44,7 +44,10 @@ class PoFileLoader extends ArrayLoader } $catalogue = parent::load($messages, $locale, $domain); - $catalogue->addResource(new FileResource($resource)); + + if (class_exists('Symfony\Component\Config\Resource\FileResource')) { + $catalogue->addResource(new FileResource($resource)); + } return $catalogue; } diff --git a/src/Symfony/Component/Translation/Loader/QtFileLoader.php b/src/Symfony/Component/Translation/Loader/QtFileLoader.php index aacfb4a55e..6dd0696c6f 100644 --- a/src/Symfony/Component/Translation/Loader/QtFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/QtFileLoader.php @@ -68,7 +68,10 @@ class QtFileLoader implements LoaderInterface } $translation = $translation->nextSibling; } - $catalogue->addResource(new FileResource($resource)); + + if (class_exists('Symfony\Component\Config\Resource\FileResource')) { + $catalogue->addResource(new FileResource($resource)); + } } libxml_use_internal_errors($internalErrors); diff --git a/src/Symfony/Component/Translation/Loader/XliffFileLoader.php b/src/Symfony/Component/Translation/Loader/XliffFileLoader.php index 79723f3830..a36217268d 100644 --- a/src/Symfony/Component/Translation/Loader/XliffFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/XliffFileLoader.php @@ -69,7 +69,10 @@ class XliffFileLoader implements LoaderInterface $catalogue->set((string) $source, $target, $domain); } - $catalogue->addResource(new FileResource($resource)); + + if (class_exists('Symfony\Component\Config\Resource\FileResource')) { + $catalogue->addResource(new FileResource($resource)); + } return $catalogue; } diff --git a/src/Symfony/Component/Translation/Loader/YamlFileLoader.php b/src/Symfony/Component/Translation/Loader/YamlFileLoader.php index e50e0fa385..fb0946cc57 100644 --- a/src/Symfony/Component/Translation/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/YamlFileLoader.php @@ -43,6 +43,10 @@ class YamlFileLoader extends ArrayLoader throw new NotFoundResourceException(sprintf('File "%s" not found.', $resource)); } + if (!class_exists('Symfony\Component\Yaml\Parser')) { + throw new \LogicException('Loading translations from the YAML format requires the Symfony Yaml component.'); + } + if (null === $this->yamlParser) { $this->yamlParser = new YamlParser(); } @@ -64,7 +68,10 @@ class YamlFileLoader extends ArrayLoader } $catalogue = parent::load($messages, $locale, $domain); - $catalogue->addResource(new FileResource($resource)); + + if (class_exists('Symfony\Component\Config\Resource\FileResource')) { + $catalogue->addResource(new FileResource($resource)); + } return $catalogue; } From b62eb73590f77fb7a1a3eb4d5c11dee95c8a4bff Mon Sep 17 00:00:00 2001 From: Restless-ET Date: Wed, 22 Apr 2015 16:50:37 +0100 Subject: [PATCH 07/11] Fix Portuguese (Portugal) translation for Security --- .../Security/Resources/translations/security.pt_PT.xlf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Security/Resources/translations/security.pt_PT.xlf b/src/Symfony/Component/Security/Resources/translations/security.pt_PT.xlf index e661000148..f2af13ea3d 100644 --- a/src/Symfony/Component/Security/Resources/translations/security.pt_PT.xlf +++ b/src/Symfony/Component/Security/Resources/translations/security.pt_PT.xlf @@ -4,7 +4,7 @@ An authentication exception occurred. - Ocorreu um excepção durante a autenticação. + Ocorreu uma excepção durante a autenticação. Authentication credentials could not be found. @@ -20,7 +20,7 @@ Cookie has already been used by someone else. - Este cookie já esta em uso. + Este cookie já está em uso. Not privileged to request the resource. @@ -64,7 +64,7 @@ Account is locked. - A conta esta trancada. + A conta está trancada. From 7c2b8755e8fdc45fab200131eae762d3bb7d196f Mon Sep 17 00:00:00 2001 From: Per Modin Date: Thu, 23 Apr 2015 00:16:43 +0200 Subject: [PATCH 08/11] [StringUtil] Fixed singularification of 'selfies' --- src/Symfony/Component/PropertyAccess/StringUtil.php | 3 +++ src/Symfony/Component/PropertyAccess/Tests/StringUtilTest.php | 1 + 2 files changed, 4 insertions(+) diff --git a/src/Symfony/Component/PropertyAccess/StringUtil.php b/src/Symfony/Component/PropertyAccess/StringUtil.php index 2160f0f422..2f31925e73 100644 --- a/src/Symfony/Component/PropertyAccess/StringUtil.php +++ b/src/Symfony/Component/PropertyAccess/StringUtil.php @@ -60,6 +60,9 @@ class StringUtil // indices (index), appendices (appendix), prices (price) array('seci', 4, false, true, array('ex', 'ix', 'ice')), + // selfies (selfie) + array('seifles', 7, true, true, 'selfie'), + // movies (movie) array('seivom', 6, true, true, 'movie'), diff --git a/src/Symfony/Component/PropertyAccess/Tests/StringUtilTest.php b/src/Symfony/Component/PropertyAccess/Tests/StringUtilTest.php index 73922cd72a..c5691ed7bd 100644 --- a/src/Symfony/Component/PropertyAccess/Tests/StringUtilTest.php +++ b/src/Symfony/Component/PropertyAccess/Tests/StringUtilTest.php @@ -119,6 +119,7 @@ class StringUtilTest extends \PHPUnit_Framework_TestCase array('sandwiches', array('sandwich', 'sandwiche')), array('scarves', array('scarf', 'scarve', 'scarff')), array('schemas', 'schema'), //schemata + array('selfies', 'selfie'), array('sheriffs', 'sheriff'), array('shoes', array('sho', 'shoe')), array('spies', 'spy'), From 2892902ead6bbf6cd26a8f9db731df7803efff4d Mon Sep 17 00:00:00 2001 From: Diego Saint Esteben Date: Thu, 23 Apr 2015 18:00:03 -0300 Subject: [PATCH 09/11] Fixed tests --- .../ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service.php | 3 --- src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php | 3 --- .../DependencyInjection/Tests/Fixtures/php/services10.php | 3 --- .../DependencyInjection/Tests/Fixtures/php/services11.php | 3 --- .../DependencyInjection/Tests/Fixtures/php/services12.php | 3 --- .../Tests/Fixtures/php/services9_compiled.php | 3 --- 6 files changed, 18 deletions(-) diff --git a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service.php b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service.php index 457686c80d..cbe96c1d5a 100644 --- a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service.php +++ b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service.php @@ -26,9 +26,6 @@ class LazyServiceProjectServiceContainer extends Container $this->services = $this->scopedServices = $this->scopeStacks = array(); - - $this->set('service_container', $this); - $this->scopes = array(); $this->scopeChildren = array(); } diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index 385400dac6..fd82e6df91 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -839,9 +839,6 @@ EOF; \$this->services = \$this->scopedServices = \$this->scopeStacks = array(); - - \$this->set('service_container', \$this); - EOF; $code .= "\n"; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php index a33b08e3ab..457eb3cce6 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php @@ -29,9 +29,6 @@ class ProjectServiceContainer extends Container $this->services = $this->scopedServices = $this->scopeStacks = array(); - - $this->set('service_container', $this); - $this->scopes = array(); $this->scopeChildren = array(); $this->methodMap = array( diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services11.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services11.php index 5a2744f6f7..630d28db06 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services11.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services11.php @@ -27,9 +27,6 @@ class ProjectServiceContainer extends Container $this->services = $this->scopedServices = $this->scopeStacks = array(); - - $this->set('service_container', $this); - $this->scopes = array(); $this->scopeChildren = array(); $this->methodMap = array( diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php index f7acc1947a..e9bd56e34b 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php @@ -33,9 +33,6 @@ class ProjectServiceContainer extends Container $this->services = $this->scopedServices = $this->scopeStacks = array(); - - $this->set('service_container', $this); - $this->scopes = array(); $this->scopeChildren = array(); $this->methodMap = array( diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php index 25b4835058..f4345fe449 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php @@ -29,9 +29,6 @@ class ProjectServiceContainer extends Container $this->services = $this->scopedServices = $this->scopeStacks = array(); - - $this->set('service_container', $this); - $this->scopes = array(); $this->scopeChildren = array(); $this->methodMap = array( From 8bf855620f959d77ce97b813f485aa9352ef6468 Mon Sep 17 00:00:00 2001 From: Bernhard Schussek Date: Fri, 24 Apr 2015 12:06:28 +0200 Subject: [PATCH 10/11] [Validator] Fixed Choice when an empty array is used in the "choices" option --- .../Validator/Constraints/ChoiceValidator.php | 2 +- .../Tests/Constraints/ChoiceValidatorTest.php | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Validator/Constraints/ChoiceValidator.php b/src/Symfony/Component/Validator/Constraints/ChoiceValidator.php index 0581d7da74..5455b7217f 100644 --- a/src/Symfony/Component/Validator/Constraints/ChoiceValidator.php +++ b/src/Symfony/Component/Validator/Constraints/ChoiceValidator.php @@ -32,7 +32,7 @@ class ChoiceValidator extends ConstraintValidator */ public function validate($value, Constraint $constraint) { - if (!$constraint->choices && !$constraint->callback) { + if (!is_array($constraint->choices) && !$constraint->callback) { throw new ConstraintDefinitionException('Either "choices" or "callback" must be specified on constraint Choice'); } diff --git a/src/Symfony/Component/Validator/Tests/Constraints/ChoiceValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/ChoiceValidatorTest.php index 59b9e03f41..f3ccd8ad5f 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/ChoiceValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/ChoiceValidatorTest.php @@ -143,6 +143,20 @@ class ChoiceValidatorTest extends AbstractConstraintValidatorTest ->assertRaised(); } + public function testInvalidChoiceEmptyChoices() + { + $constraint = new Choice(array( + 'choices' => array(), + 'message' => 'myMessage', + )); + + $this->validator->validate('baz', $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"baz"') + ->assertRaised(); + } + public function testInvalidChoiceMultiple() { $constraint = new Choice(array( From 3bfbf45ed2403b18b9c1934f37c4c0557c555f24 Mon Sep 17 00:00:00 2001 From: Diego Saint Esteben Date: Sat, 25 Apr 2015 13:37:49 -0300 Subject: [PATCH 11/11] [DependencyInjection] Removed extra strtolower calls --- .../DependencyInjection/ContainerBuilder.php | 14 ++++++++------ .../Tests/ContainerBuilderTest.php | 7 +++++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index 0d63c0be39..3936ec585d 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -470,7 +470,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface throw new LogicException(sprintf('The service "%s" has a circular reference to itself.', $id)); } - if (!$this->hasDefinition($id) && isset($this->aliasDefinitions[$id])) { + if (!array_key_exists($id, $this->definitions) && isset($this->aliasDefinitions[$id])) { return $this->get($this->aliasDefinitions[$id]); } @@ -686,7 +686,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface throw new InvalidArgumentException('$id must be a string, or an Alias object.'); } - if ($alias === strtolower($id)) { + if ($alias === (string) $id) { throw new InvalidArgumentException(sprintf('An alias can not reference itself, got a circular reference on "%s".', $alias)); } @@ -748,7 +748,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface { $id = strtolower($id); - if (!$this->hasAlias($id)) { + if (!isset($this->aliasDefinitions[$id])) { throw new InvalidArgumentException(sprintf('The service alias "%s" does not exist.', $id)); } @@ -866,7 +866,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface { $id = strtolower($id); - if (!$this->hasDefinition($id)) { + if (!array_key_exists($id, $this->definitions)) { throw new InvalidArgumentException(sprintf('The service definition "%s" does not exist.', $id)); } @@ -888,8 +888,10 @@ class ContainerBuilder extends Container implements TaggedContainerInterface */ public function findDefinition($id) { - while ($this->hasAlias($id)) { - $id = (string) $this->getAlias($id); + $id = strtolower($id); + + while (isset($this->aliasDefinitions[$id])) { + $id = (string) $this->aliasDefinitions[$id]; } return $this->getDefinition($id); diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php index 22f4b5bd32..2d4eee0a61 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -189,6 +189,13 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase $this->assertTrue($builder->has('bar'), '->setAlias() defines a new service'); $this->assertTrue($builder->get('bar') === $builder->get('foo'), '->setAlias() creates a service that is an alias to another one'); + try { + $builder->setAlias('foobar', 'foobar'); + $this->fail('->setAlias() throws an InvalidArgumentException if the alias references itself'); + } catch (\InvalidArgumentException $e) { + $this->assertEquals('An alias can not reference itself, got a circular reference on "foobar".', $e->getMessage(), '->setAlias() throws an InvalidArgumentException if the alias references itself'); + } + try { $builder->getAlias('foobar'); $this->fail('->getAlias() throws an InvalidArgumentException if the alias does not exist');