From f14325422069ab86a2ec76c1846d73e4c2155b65 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 2 Aug 2014 09:05:01 +0200 Subject: [PATCH 1/8] built-in server: exit when docroot does not exist When the server:run command is run with an invalid document root directory (for example, when being in the app directory and not changing the document root to ../web/), the command crashes on Windows with a 267 exit code. On Linux, the server starts but just publishes internal server errors. --- .../FrameworkBundle/Command/ServerRunCommand.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php index 63588d5264025..35351679103db 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php @@ -81,6 +81,14 @@ protected function configure() */ protected function execute(InputInterface $input, OutputInterface $output) { + $documentRoot = $input->getOption('docroot'); + + if (!is_dir($documentRoot)) { + $output->writeln(sprintf('The given document root directory "%s" does not exist', $documentRoot)); + + return 1; + } + $env = $this->getContainer()->getParameter('kernel.environment'); if ('prod' === $env) { @@ -96,7 +104,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $output->writeln(sprintf("Server running on http://%s\n", $input->getArgument('address'))); $builder = new ProcessBuilder(array(PHP_BINARY, '-S', $input->getArgument('address'), $router)); - $builder->setWorkingDirectory($input->getOption('docroot')); + $builder->setWorkingDirectory($documentRoot); $builder->setTimeout(null); $builder->getProcess()->run(function ($type, $buffer) use ($output) { if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { From 8504d02c51102802d9108cf40105d61b706b8c68 Mon Sep 17 00:00:00 2001 From: Christian Raue Date: Sat, 2 Aug 2014 15:07:47 +0200 Subject: [PATCH 2/8] fixed whitespace in Twig form template --- .../Bridge/Twig/Resources/views/Form/form_div_layout.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig index c14031a713fab..d3b4cafb6c555 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig @@ -299,7 +299,7 @@ {% block widget_attributes -%} id="{{ id }}" name="{{ full_name }}"{% if read_only %} readonly="readonly"{% endif %}{% if disabled %} disabled="disabled"{% endif %}{% if required %} required="required"{% endif %}{% if max_length %} maxlength="{{ max_length }}"{% endif %}{% if pattern %} pattern="{{ pattern }}"{% endif %} - {% for attrname, attrvalue in attr %}{% if attrname in ['placeholder', 'title'] %}{{ attrname }}="{{ attrvalue|trans({}, translation_domain) }}" {% else %}{{ attrname }}="{{ attrvalue }}" {% endif %}{% endfor %} + {%- for attrname, attrvalue in attr %} {% if attrname in ['placeholder', 'title'] %}{{ attrname }}="{{ attrvalue|trans({}, translation_domain) }}"{% else %}{{ attrname }}="{{ attrvalue }}"{% endif %}{% endfor %} {%- endblock widget_attributes %} {% block widget_container_attributes -%} From 18e3e6fe2012763d3dc0c89540a87f6fa11f9d6c Mon Sep 17 00:00:00 2001 From: Hany el-Kerdany Date: Mon, 4 Aug 2014 10:10:46 +0300 Subject: [PATCH 3/8] [DependencyInjection] fixed missing 'factory-class' attribute in XmlDumper output Symfony\Component\DependencyInjection\Dumper\XmlDumper didn't write 'factory-class' XML attribute for definitions on which setFactoryClass() was called. This caused the Container[Builder] to throw an exception when the relevant service is being requested/initiated after loading the dumped XML: `Uncaught Exception Symfony\Component\DependencyInjection\Exception\RuntimeException: "Cannot create service "xxx" from factory method without a factory service or factory class." at ///vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php` Fixed the problem, and updated the relevant test fixture. --- .../Component/DependencyInjection/Dumper/XmlDumper.php | 3 +++ .../DependencyInjection/Tests/Fixtures/xml/services9.xml | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php index a311af348e348..6cdc68fc204de 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php @@ -119,6 +119,9 @@ private function addService($definition, $id, \DOMElement $parent) if ($definition->getFactoryMethod()) { $service->setAttribute('factory-method', $definition->getFactoryMethod()); } + if ($definition->getFactoryClass()) { + $service->setAttribute('factory-class', $definition->getFactoryClass()); + } if ($definition->getFactoryService()) { $service->setAttribute('factory-service', $definition->getFactoryService()); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml index 7b99fe2667e06..de065464c5629 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml @@ -6,7 +6,7 @@ bar - + foo @@ -35,7 +35,7 @@ %foo_bar% - + From 99ee01d4823477a555f7076c2bc9c4116b2f7fcf Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 4 Aug 2014 12:32:26 +0200 Subject: [PATCH 4/8] removed some .gitattributes that should have been removed a lot time ago --- src/Symfony/Component/PropertyAccess/.gitattributes | 2 -- src/Symfony/Component/Stopwatch/.gitattributes | 2 -- 2 files changed, 4 deletions(-) delete mode 100644 src/Symfony/Component/PropertyAccess/.gitattributes delete mode 100644 src/Symfony/Component/Stopwatch/.gitattributes diff --git a/src/Symfony/Component/PropertyAccess/.gitattributes b/src/Symfony/Component/PropertyAccess/.gitattributes deleted file mode 100644 index 80481513cff2c..0000000000000 --- a/src/Symfony/Component/PropertyAccess/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -/Tests export-ignore -phpunit.xml.dist export-ignore diff --git a/src/Symfony/Component/Stopwatch/.gitattributes b/src/Symfony/Component/Stopwatch/.gitattributes deleted file mode 100644 index e742c9b35160a..0000000000000 --- a/src/Symfony/Component/Stopwatch/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -Tests/ export-ignore -phpunit.xml.dist export-ignore From 9b550d6324ef2c6b2ec95ed3378928f584aa9a4e Mon Sep 17 00:00:00 2001 From: Seb Koelen Date: Mon, 4 Aug 2014 11:47:45 +0200 Subject: [PATCH 5/8] Plural fix --- .../Component/PropertyAccess/StringUtil.php | 3 + .../PropertyAccess/Tests/StringUtilTest.php | 160 ++++++++++-------- 2 files changed, 93 insertions(+), 70 deletions(-) diff --git a/src/Symfony/Component/PropertyAccess/StringUtil.php b/src/Symfony/Component/PropertyAccess/StringUtil.php index 50a8eb40920a7..dd9ee3496c652 100644 --- a/src/Symfony/Component/PropertyAccess/StringUtil.php +++ b/src/Symfony/Component/PropertyAccess/StringUtil.php @@ -75,6 +75,9 @@ class StringUtil // objectives (objective), alternative (alternatives) array('sevit', 5, true, true, 'tive'), + // drives (drive) + array('sevird', 6, false, true, 'drive'), + // lives (life), wives (wife) array('sevi', 4, false, true, 'ife'), diff --git a/src/Symfony/Component/PropertyAccess/Tests/StringUtilTest.php b/src/Symfony/Component/PropertyAccess/Tests/StringUtilTest.php index 92df8f1f73546..1aff5229819f9 100644 --- a/src/Symfony/Component/PropertyAccess/Tests/StringUtilTest.php +++ b/src/Symfony/Component/PropertyAccess/Tests/StringUtilTest.php @@ -20,114 +20,127 @@ public function singularifyProvider() // see http://english-zone.com/spelling/plurals.html // see http://www.scribd.com/doc/3271143/List-of-100-Irregular-Plural-Nouns-in-English return array( - array('tags', 'tag'), + array('accesses', 'access'), + array('addresses', 'address'), + array('agendas', 'agenda'), + array('alumnae', 'alumna'), array('alumni', 'alumnus'), - array('funguses', array('fungus', 'funguse', 'fungusis')), - array('fungi', 'fungus'), - array('axes', array('ax', 'axe', 'axis')), - array('appendices', array('appendex', 'appendix', 'appendice')), - array('indices', array('index', 'indix', 'indice')), - array('prices', array('prex', 'prix', 'price')), - array('indexes', 'index'), - array('children', 'child'), - array('men', 'man'), - array('women', 'woman'), - array('oxen', 'ox'), - array('bacteria', array('bacterion', 'bacterium')), - array('criteria', array('criterion', 'criterium')), - array('feet', 'foot'), - array('nebulae', 'nebula'), - array('babies', 'baby'), - array('hooves', array('hoof', 'hoove', 'hooff')), - array('chateaux', 'chateau'), - array('echoes', array('echo', 'echoe')), array('analyses', array('analys', 'analyse', 'analysis')), - array('theses', array('thes', 'these', 'thesis')), - array('foci', 'focus'), - array('focuses', array('focus', 'focuse', 'focusis')), - array('oases', array('oas', 'oase', 'oasis')), - array('matrices', array('matrex', 'matrix', 'matrice')), - array('matrixes', 'matrix'), - array('bureaus', 'bureau'), - array('bureaux', 'bureau'), - array('beaux', 'beau'), - array('data', array('daton', 'datum')), - array('phenomena', array('phenomenon', 'phenomenum')), - array('strata', array('straton', 'stratum')), - array('geese', 'goose'), - array('teeth', 'tooth'), array('antennae', 'antenna'), array('antennas', 'antenna'), - array('houses', array('hous', 'house', 'housis')), + array('appendices', array('appendex', 'appendix', 'appendice')), array('arches', array('arch', 'arche')), array('atlases', array('atlas', 'atlase', 'atlasis')), + array('axes', array('ax', 'axe', 'axis')), + array('babies', 'baby'), + array('bacteria', array('bacterion', 'bacterium')), + array('bases', array('bas', 'base', 'basis')), array('batches', array('batch', 'batche')), - array('bushes', array('bush', 'bushe')), + array('beaux', 'beau'), + array('bees', array('be', 'bee')), + array('boxes', 'box'), + array('boys', 'boy'), + array('bureaus', 'bureau'), + array('bureaux', 'bureau'), array('buses', array('bus', 'buse', 'busis')), + array('bushes', array('bush', 'bushe')), array('calves', array('calf', 'calve', 'calff')), + array('cars', 'car'), + array('cassettes', array('cassett', 'cassette')), + array('caves', array('caf', 'cave', 'caff')), + array('chateaux', 'chateau'), + array('cheeses', array('chees', 'cheese', 'cheesis')), + array('children', 'child'), array('circuses', array('circus', 'circuse', 'circusis')), + array('cliffs', 'cliff'), array('crises', array('cris', 'crise', 'crisis')), + array('criteria', array('criterion', 'criterium')), + array('cups', 'cup'), + array('data', array('daton', 'datum')), + array('days', 'day'), + array('discos', 'disco'), + array('drives', 'drive'), + array('drivers', 'driver'), array('dwarves', array('dwarf', 'dwarve', 'dwarff')), + array('echoes', array('echo', 'echoe')), array('elves', array('elf', 'elve', 'elff')), array('emphases', array('emphas', 'emphase', 'emphasis')), array('faxes', 'fax'), + array('feet', 'foot'), + array('foci', 'focus'), + array('focuses', array('focus', 'focuse', 'focusis')), + array('formulae', 'formula'), + array('formulas', 'formula'), + array('fungi', 'fungus'), + array('funguses', array('fungus', 'funguse', 'fungusis')), + array('garages', array('garag', 'garage')), + array('geese', 'goose'), array('halves', array('half', 'halve', 'halff')), + array('hats', 'hat'), array('heroes', array('hero', 'heroe')), + array('hippopotamuses', array('hippopotamus', 'hippopotamuse', 'hippopotamusis')), //hippopotami array('hoaxes', 'hoax'), + array('hooves', array('hoof', 'hoove', 'hooff')), + array('houses', array('hous', 'house', 'housis')), + array('indexes', 'index'), + array('indices', array('index', 'indix', 'indice')), + array('ions', 'ion'), array('irises', array('iris', 'irise', 'irisis')), array('kisses', 'kiss'), - array('addresses', 'address'), - array('accesses', 'access'), array('knives', 'knife'), - array('lives', 'life'), + array('lamps', 'lamp'), + array('leaves', array('leaf', 'leave', 'leaff')), array('lice', 'louse'), + array('lives', 'life'), + array('matrices', array('matrex', 'matrix', 'matrice')), + array('matrixes', 'matrix'), + array('men', 'man'), array('mice', 'mouse'), + array('moves', 'move'), + array('nebulae', 'nebula'), array('neuroses', array('neuros', 'neurose', 'neurosis')), + array('oases', array('oas', 'oase', 'oasis')), + array('objectives', 'objective'), + array('oxen', 'ox'), + array('parties', 'party'), + array('phenomena', array('phenomenon', 'phenomenum')), + array('photos', 'photo'), + array('pianos', 'piano'), array('plateaux', 'plateau'), array('poppies', 'poppy'), + array('prices', array('prex', 'prix', 'price')), array('quizzes', 'quiz'), + array('radii', 'radius'), + array('roofs', 'roof'), + array('roses', array('ros', 'rose', 'rosis')), + array('sandwiches', array('sandwich', 'sandwiche')), array('scarves', array('scarf', 'scarve', 'scarff')), + array('schemas', 'schema'), //schemata + array('sheriffs', 'sheriff'), + array('shoes', array('sho', 'shoe')), array('spies', 'spy'), + array('staves', array('staf', 'stave', 'staff')), array('stories', 'story'), + array('strata', array('straton', 'stratum')), + array('suitcases', array('suitcas', 'suitcase', 'suitcasis')), array('syllabi', 'syllabus'), + array('tags', 'tag'), + array('teeth', 'tooth'), + array('theses', array('thes', 'these', 'thesis')), array('thieves', array('thief', 'thieve', 'thieff')), + array('trees', array('tre', 'tree')), array('waltzes', array('waltz', 'waltze')), - array('wharves', array('wharf', 'wharve', 'wharff')), - array('caves', array('caf', 'cave', 'caff')), - array('staves', array('staf', 'stave', 'staff')), array('wives', 'wife'), - array('ions', 'ion'), - array('bases', array('bas', 'base', 'basis')), - array('cars', 'car'), - array('cassettes', array('cassett', 'cassette')), - array('lamps', 'lamp'), - array('hats', 'hat'), - array('cups', 'cup'), - array('boxes', 'box'), - array('sandwiches', array('sandwich', 'sandwiche')), - array('suitcases', array('suitcas', 'suitcase', 'suitcasis')), - array('roses', array('ros', 'rose', 'rosis')), - array('garages', array('garag', 'garage')), - array('shoes', array('sho', 'shoe')), - array('days', 'day'), - array('boys', 'boy'), - array('roofs', 'roof'), - array('cliffs', 'cliff'), - array('sheriffs', 'sheriff'), - array('discos', 'disco'), - array('pianos', 'piano'), - array('photos', 'photo'), - array('trees', array('tre', 'tree')), - array('bees', array('be', 'bee')), - array('cheeses', array('chees', 'cheese', 'cheesis')), - array('radii', 'radius'), - array('objectives', 'objective'), - array('moves', 'move'), // test casing: if the first letter was uppercase, it should remain so array('Men', 'Man'), array('GrandChildren', 'GrandChild'), array('SubTrees', array('SubTre', 'SubTree')), + + // Known issues + //array('insignia', 'insigne'), + //array('insignias', 'insigne'), + //array('rattles', 'rattle'), ); } @@ -136,6 +149,13 @@ public function singularifyProvider() */ public function testSingularify($plural, $singular) { - $this->assertEquals($singular, StringUtil::singularify($plural)); + $single = StringUtil::singularify($plural); + if (is_string($singular) && is_array($single)) { + $this->fail("--- Expected\n`string`: " . $singular . "\n+++ Actual\n`array`: " . implode(', ', $single)); + } elseif (is_array($singular) && is_string($single)) { + $this->fail("--- Expected\n`array`: " . implode(', ', $singular) . "\n+++ Actual\n`string`: " . $single); + } + + $this->assertEquals($singular, $single); } } From 16bd88e61f014080906e9dbb1ce67a4612d8d64d Mon Sep 17 00:00:00 2001 From: Emanuele Iannone Date: Sun, 3 Aug 2014 20:25:41 +0200 Subject: [PATCH 6/8] [TwigBridge] [Form] Fixed some extra empty spaces --- .../Twig/Resources/views/Form/form_div_layout.html.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig index d3b4cafb6c555..badfa8492669f 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig @@ -52,9 +52,9 @@ {%- endblock choice_widget_expanded %} {% block choice_widget_collapsed -%} - {% if required and empty_value is none and not empty_value_in_choices and not multiple %} + {% if required and empty_value is none and not empty_value_in_choices and not multiple -%} {% set required = false %} - {% endif %} + {%- endif -%}