Skip to content

Commit

Permalink
Merge branch '2.4' into 2.5
Browse files Browse the repository at this point in the history
* 2.4:
  Fixed relative redirects for ambiguous paths
  [BrowserKit] Fix browser kit redirect with ports
  [TwigBridge] [Form] Fixed some extra empty spaces
  Plural fix
  removed some .gitattributes that should have been removed a lot time ago
  [DependencyInjection] fixed missing 'factory-class' attribute in XmlDumper output
  fixed whitespace in Twig form template
  built-in server: exit when docroot does not exist

Conflicts:
	src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php
	src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml
  • Loading branch information
fabpot committed Aug 6, 2014
2 parents cd322c4 + 6f56ea4 commit 6f07919
Show file tree
Hide file tree
Showing 10 changed files with 125 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
{% block choice_widget_collapsed -%}
{% if required and empty_value is none and not empty_value_in_choices and not multiple -%}
{% set required = false %}
{% endif %}
{%- endif -%}
<select {{ block('widget_attributes') }}{% if multiple %} multiple="multiple"{% endif %}>
{% if empty_value is not none -%}
<option value=""{% if required and value is empty %} selected="selected"{% endif %}>{{ empty_value|trans({}, translation_domain) }}</option>
Expand Down
10 changes: 9 additions & 1 deletion src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ protected function configure()
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$documentRoot = $input->getOption('docroot');

if (!is_dir($documentRoot)) {
$output->writeln(sprintf('<error>The given document root directory "%s" does not exist</error>', $documentRoot));

return 1;
}

$env = $this->getContainer()->getParameter('kernel.environment');

if ('prod' === $env) {
Expand All @@ -91,7 +99,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$output->writeln(sprintf("Server running on <info>http://%s</info>\n", $input->getArgument('address')));

$builder = $this->createPhpProcessBuilder($input, $output, $env);
$builder->setWorkingDirectory($input->getOption('docroot'));
$builder->setWorkingDirectory($documentRoot);
$builder->setTimeout(null);
$process = $builder->getProcess();

Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/BrowserKit/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ public function request($method, $uri, array $parameters = array(), array $files

$uri = $this->getAbsoluteUri($uri);

if (isset($server['HTTP_HOST'])) {
if (!empty($server['HTTP_HOST'])) {
$uri = preg_replace('{^(https?\://)'.preg_quote($this->extractHost($uri)).'}', '${1}'.$server['HTTP_HOST'], $uri);
}

Expand Down Expand Up @@ -598,7 +598,7 @@ protected function requestFromRequest(Request $request, $changeHistory = true)

private function updateServerFromUri($server, $uri)
{
$server['HTTP_HOST'] = parse_url($uri, PHP_URL_HOST);
$server['HTTP_HOST'] = $this->extractHost($uri);
$scheme = parse_url($uri, PHP_URL_SCHEME);
$server['HTTPS'] = null === $scheme ? $server['HTTPS'] : 'https' == $scheme;
unset($server['HTTP_IF_NONE_MATCH'], $server['HTTP_IF_MODIFIED_SINCE']);
Expand Down
17 changes: 15 additions & 2 deletions src/Symfony/Component/BrowserKit/Tests/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,19 @@ public function testFollowRedirect()
}
}

public function testFollowRelativeRedirect()
{
$client = new TestClient();
$client->setNextResponse(new Response('', 302, array('Location' => '/redirected')));
$client->request('GET', 'http://www.example.com/foo/foobar');
$this->assertEquals('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows a redirect if any');

$client = new TestClient();
$client->setNextResponse(new Response('', 302, array('Location' => '/redirected:1234')));
$client->request('GET', 'http://www.example.com/foo/foobar');
$this->assertEquals('http://www.example.com/redirected:1234', $client->getRequest()->getUri(), '->followRedirect() follows relative urls');
}

public function testFollowRedirectWithMaxRedirects()
{
$client = new TestClient();
Expand Down Expand Up @@ -452,11 +465,11 @@ public function testFollowRedirectWithPort()
$headers = array(
'HTTP_HOST' => 'www.example.com:8080',
'HTTP_USER_AGENT' => 'Symfony2 BrowserKit',
'HTTPS' => false
'HTTPS' => false,
'HTTP_REFERER' => 'http://www.example.com:8080/'
);

$client = new TestClient();
$client->followRedirects(false);
$client->setNextResponse(new Response('', 302, array(
'Location' => 'http://www.example.com:8080/redirected',
)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parameter key="foo">bar</parameter>
</parameters>
<services>
<service id="foo" class="Bar\FooClass" factory-method="getInstance">
<service id="foo" class="Bar\FooClass" factory-method="getInstance" factory-class="Bar\FooClass">
<tag name="foo" foo="foo"/>
<tag name="foo" bar="bar"/>
<argument>foo</argument>
Expand Down Expand Up @@ -35,7 +35,7 @@
<argument>%foo_bar%</argument>
<configurator service="foo.baz" method="configure"/>
</service>
<service id="foo.baz" class="%baz_class%" factory-method="getInstance">
<service id="foo.baz" class="%baz_class%" factory-method="getInstance" factory-class="%baz_class%">
<configurator class="%baz_class%" method="configureStatic1"/>
</service>
<service id="foo_bar" class="%foo_class%" scope="prototype"/>
Expand Down
2 changes: 0 additions & 2 deletions src/Symfony/Component/PropertyAccess/.gitattributes

This file was deleted.

3 changes: 3 additions & 0 deletions src/Symfony/Component/PropertyAccess/StringUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),

Expand Down
160 changes: 90 additions & 70 deletions src/Symfony/Component/PropertyAccess/Tests/StringUtilTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
);
}

Expand All @@ -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);
}
}
2 changes: 0 additions & 2 deletions src/Symfony/Component/Stopwatch/.gitattributes

This file was deleted.

0 comments on commit 6f07919

Please sign in to comment.