Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6f56ea4

Browse files
committed
Merge branch '2.3' into 2.4
* 2.3: 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/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
2 parents a4ec72e + 678f772 commit 6f56ea4

File tree

10 files changed

+125
-82
lines changed

10 files changed

+125
-82
lines changed

src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
{% block choice_widget_collapsed -%}
5555
{% if required and empty_value is none and not empty_value_in_choices and not multiple -%}
5656
{% set required = false %}
57-
{% endif %}
57+
{%- endif -%}
5858
<select {{ block('widget_attributes') }}{% if multiple %} multiple="multiple"{% endif %}>
5959
{% if empty_value is not none -%}
6060
<option value=""{% if required and value is empty %} selected="selected"{% endif %}>{{ empty_value|trans({}, translation_domain) }}</option>

src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ protected function configure()
8181
*/
8282
protected function execute(InputInterface $input, OutputInterface $output)
8383
{
84+
$documentRoot = $input->getOption('docroot');
85+
86+
if (!is_dir($documentRoot)) {
87+
$output->writeln(sprintf('<error>The given document root directory "%s" does not exist</error>', $documentRoot));
88+
89+
return 1;
90+
}
91+
8492
$env = $this->getContainer()->getParameter('kernel.environment');
8593

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

98106
$builder = new ProcessBuilder(array(PHP_BINARY, '-S', $input->getArgument('address'), $router));
99-
$builder->setWorkingDirectory($input->getOption('docroot'));
107+
$builder->setWorkingDirectory($documentRoot);
100108
$builder->setTimeout(null);
101109
$builder->getProcess()->run(function ($type, $buffer) use ($output) {
102110
if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {

src/Symfony/Component/BrowserKit/Client.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ public function request($method, $uri, array $parameters = array(), array $files
298298

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

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

@@ -602,7 +602,7 @@ protected function requestFromRequest(Request $request, $changeHistory = true)
602602

603603
private function updateServerFromUri($server, $uri)
604604
{
605-
$server['HTTP_HOST'] = parse_url($uri, PHP_URL_HOST);
605+
$server['HTTP_HOST'] = $this->extractHost($uri);
606606
$scheme = parse_url($uri, PHP_URL_SCHEME);
607607
$server['HTTPS'] = null === $scheme ? $server['HTTPS'] : 'https' == $scheme;
608608
unset($server['HTTP_IF_NONE_MATCH'], $server['HTTP_IF_MODIFIED_SINCE']);

src/Symfony/Component/BrowserKit/Tests/ClientTest.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,19 @@ public function testFollowRedirect()
367367
}
368368
}
369369

370+
public function testFollowRelativeRedirect()
371+
{
372+
$client = new TestClient();
373+
$client->setNextResponse(new Response('', 302, array('Location' => '/redirected')));
374+
$client->request('GET', 'http://www.example.com/foo/foobar');
375+
$this->assertEquals('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows a redirect if any');
376+
377+
$client = new TestClient();
378+
$client->setNextResponse(new Response('', 302, array('Location' => '/redirected:1234')));
379+
$client->request('GET', 'http://www.example.com/foo/foobar');
380+
$this->assertEquals('http://www.example.com/redirected:1234', $client->getRequest()->getUri(), '->followRedirect() follows relative urls');
381+
}
382+
370383
public function testFollowRedirectWithMaxRedirects()
371384
{
372385
$client = new TestClient();
@@ -452,11 +465,11 @@ public function testFollowRedirectWithPort()
452465
$headers = array(
453466
'HTTP_HOST' => 'www.example.com:8080',
454467
'HTTP_USER_AGENT' => 'Symfony2 BrowserKit',
455-
'HTTPS' => false
468+
'HTTPS' => false,
469+
'HTTP_REFERER' => 'http://www.example.com:8080/'
456470
);
457471

458472
$client = new TestClient();
459-
$client->followRedirects(false);
460473
$client->setNextResponse(new Response('', 302, array(
461474
'Location' => 'http://www.example.com:8080/redirected',
462475
)));

src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ private function addService($definition, $id, \DOMElement $parent)
120120
if ($definition->getFactoryMethod()) {
121121
$service->setAttribute('factory-method', $definition->getFactoryMethod());
122122
}
123+
if ($definition->getFactoryClass()) {
124+
$service->setAttribute('factory-class', $definition->getFactoryClass());
125+
}
123126
if ($definition->getFactoryService()) {
124127
$service->setAttribute('factory-service', $definition->getFactoryService());
125128
}

src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parameter key="foo">bar</parameter>
77
</parameters>
88
<services>
9-
<service id="foo" class="FooClass" factory-method="getInstance">
9+
<service id="foo" class="FooClass" factory-method="getInstance" factory-class="FooClass">
1010
<tag name="foo" foo="foo"/>
1111
<tag name="foo" bar="bar"/>
1212
<argument>foo</argument>
@@ -35,7 +35,7 @@
3535
<argument>%foo_bar%</argument>
3636
<configurator service="foo.baz" method="configure"/>
3737
</service>
38-
<service id="foo.baz" class="%baz_class%" factory-method="getInstance">
38+
<service id="foo.baz" class="%baz_class%" factory-method="getInstance" factory-class="%baz_class%">
3939
<configurator class="%baz_class%" method="configureStatic1"/>
4040
</service>
4141
<service id="foo_bar" class="%foo_class%" scope="prototype"/>

src/Symfony/Component/PropertyAccess/.gitattributes

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/Symfony/Component/PropertyAccess/StringUtil.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ class StringUtil
7575
// objectives (objective), alternative (alternatives)
7676
array('sevit', 5, true, true, 'tive'),
7777

78+
// drives (drive)
79+
array('sevird', 6, false, true, 'drive'),
80+
7881
// lives (life), wives (wife)
7982
array('sevi', 4, false, true, 'ife'),
8083

src/Symfony/Component/PropertyAccess/Tests/StringUtilTest.php

Lines changed: 90 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -20,114 +20,127 @@ public function singularifyProvider()
2020
// see http://english-zone.com/spelling/plurals.html
2121
// see http://www.scribd.com/doc/3271143/List-of-100-Irregular-Plural-Nouns-in-English
2222
return array(
23-
array('tags', 'tag'),
23+
array('accesses', 'access'),
24+
array('addresses', 'address'),
25+
array('agendas', 'agenda'),
26+
array('alumnae', 'alumna'),
2427
array('alumni', 'alumnus'),
25-
array('funguses', array('fungus', 'funguse', 'fungusis')),
26-
array('fungi', 'fungus'),
27-
array('axes', array('ax', 'axe', 'axis')),
28-
array('appendices', array('appendex', 'appendix', 'appendice')),
29-
array('indices', array('index', 'indix', 'indice')),
30-
array('prices', array('prex', 'prix', 'price')),
31-
array('indexes', 'index'),
32-
array('children', 'child'),
33-
array('men', 'man'),
34-
array('women', 'woman'),
35-
array('oxen', 'ox'),
36-
array('bacteria', array('bacterion', 'bacterium')),
37-
array('criteria', array('criterion', 'criterium')),
38-
array('feet', 'foot'),
39-
array('nebulae', 'nebula'),
40-
array('babies', 'baby'),
41-
array('hooves', array('hoof', 'hoove', 'hooff')),
42-
array('chateaux', 'chateau'),
43-
array('echoes', array('echo', 'echoe')),
4428
array('analyses', array('analys', 'analyse', 'analysis')),
45-
array('theses', array('thes', 'these', 'thesis')),
46-
array('foci', 'focus'),
47-
array('focuses', array('focus', 'focuse', 'focusis')),
48-
array('oases', array('oas', 'oase', 'oasis')),
49-
array('matrices', array('matrex', 'matrix', 'matrice')),
50-
array('matrixes', 'matrix'),
51-
array('bureaus', 'bureau'),
52-
array('bureaux', 'bureau'),
53-
array('beaux', 'beau'),
54-
array('data', array('daton', 'datum')),
55-
array('phenomena', array('phenomenon', 'phenomenum')),
56-
array('strata', array('straton', 'stratum')),
57-
array('geese', 'goose'),
58-
array('teeth', 'tooth'),
5929
array('antennae', 'antenna'),
6030
array('antennas', 'antenna'),
61-
array('houses', array('hous', 'house', 'housis')),
31+
array('appendices', array('appendex', 'appendix', 'appendice')),
6232
array('arches', array('arch', 'arche')),
6333
array('atlases', array('atlas', 'atlase', 'atlasis')),
34+
array('axes', array('ax', 'axe', 'axis')),
35+
array('babies', 'baby'),
36+
array('bacteria', array('bacterion', 'bacterium')),
37+
array('bases', array('bas', 'base', 'basis')),
6438
array('batches', array('batch', 'batche')),
65-
array('bushes', array('bush', 'bushe')),
39+
array('beaux', 'beau'),
40+
array('bees', array('be', 'bee')),
41+
array('boxes', 'box'),
42+
array('boys', 'boy'),
43+
array('bureaus', 'bureau'),
44+
array('bureaux', 'bureau'),
6645
array('buses', array('bus', 'buse', 'busis')),
46+
array('bushes', array('bush', 'bushe')),
6747
array('calves', array('calf', 'calve', 'calff')),
48+
array('cars', 'car'),
49+
array('cassettes', array('cassett', 'cassette')),
50+
array('caves', array('caf', 'cave', 'caff')),
51+
array('chateaux', 'chateau'),
52+
array('cheeses', array('chees', 'cheese', 'cheesis')),
53+
array('children', 'child'),
6854
array('circuses', array('circus', 'circuse', 'circusis')),
55+
array('cliffs', 'cliff'),
6956
array('crises', array('cris', 'crise', 'crisis')),
57+
array('criteria', array('criterion', 'criterium')),
58+
array('cups', 'cup'),
59+
array('data', array('daton', 'datum')),
60+
array('days', 'day'),
61+
array('discos', 'disco'),
62+
array('drives', 'drive'),
63+
array('drivers', 'driver'),
7064
array('dwarves', array('dwarf', 'dwarve', 'dwarff')),
65+
array('echoes', array('echo', 'echoe')),
7166
array('elves', array('elf', 'elve', 'elff')),
7267
array('emphases', array('emphas', 'emphase', 'emphasis')),
7368
array('faxes', 'fax'),
69+
array('feet', 'foot'),
70+
array('foci', 'focus'),
71+
array('focuses', array('focus', 'focuse', 'focusis')),
72+
array('formulae', 'formula'),
73+
array('formulas', 'formula'),
74+
array('fungi', 'fungus'),
75+
array('funguses', array('fungus', 'funguse', 'fungusis')),
76+
array('garages', array('garag', 'garage')),
77+
array('geese', 'goose'),
7478
array('halves', array('half', 'halve', 'halff')),
79+
array('hats', 'hat'),
7580
array('heroes', array('hero', 'heroe')),
81+
array('hippopotamuses', array('hippopotamus', 'hippopotamuse', 'hippopotamusis')), //hippopotami
7682
array('hoaxes', 'hoax'),
83+
array('hooves', array('hoof', 'hoove', 'hooff')),
84+
array('houses', array('hous', 'house', 'housis')),
85+
array('indexes', 'index'),
86+
array('indices', array('index', 'indix', 'indice')),
87+
array('ions', 'ion'),
7788
array('irises', array('iris', 'irise', 'irisis')),
7889
array('kisses', 'kiss'),
79-
array('addresses', 'address'),
80-
array('accesses', 'access'),
8190
array('knives', 'knife'),
82-
array('lives', 'life'),
91+
array('lamps', 'lamp'),
92+
array('leaves', array('leaf', 'leave', 'leaff')),
8393
array('lice', 'louse'),
94+
array('lives', 'life'),
95+
array('matrices', array('matrex', 'matrix', 'matrice')),
96+
array('matrixes', 'matrix'),
97+
array('men', 'man'),
8498
array('mice', 'mouse'),
99+
array('moves', 'move'),
100+
array('nebulae', 'nebula'),
85101
array('neuroses', array('neuros', 'neurose', 'neurosis')),
102+
array('oases', array('oas', 'oase', 'oasis')),
103+
array('objectives', 'objective'),
104+
array('oxen', 'ox'),
105+
array('parties', 'party'),
106+
array('phenomena', array('phenomenon', 'phenomenum')),
107+
array('photos', 'photo'),
108+
array('pianos', 'piano'),
86109
array('plateaux', 'plateau'),
87110
array('poppies', 'poppy'),
111+
array('prices', array('prex', 'prix', 'price')),
88112
array('quizzes', 'quiz'),
113+
array('radii', 'radius'),
114+
array('roofs', 'roof'),
115+
array('roses', array('ros', 'rose', 'rosis')),
116+
array('sandwiches', array('sandwich', 'sandwiche')),
89117
array('scarves', array('scarf', 'scarve', 'scarff')),
118+
array('schemas', 'schema'), //schemata
119+
array('sheriffs', 'sheriff'),
120+
array('shoes', array('sho', 'shoe')),
90121
array('spies', 'spy'),
122+
array('staves', array('staf', 'stave', 'staff')),
91123
array('stories', 'story'),
124+
array('strata', array('straton', 'stratum')),
125+
array('suitcases', array('suitcas', 'suitcase', 'suitcasis')),
92126
array('syllabi', 'syllabus'),
127+
array('tags', 'tag'),
128+
array('teeth', 'tooth'),
129+
array('theses', array('thes', 'these', 'thesis')),
93130
array('thieves', array('thief', 'thieve', 'thieff')),
131+
array('trees', array('tre', 'tree')),
94132
array('waltzes', array('waltz', 'waltze')),
95-
array('wharves', array('wharf', 'wharve', 'wharff')),
96-
array('caves', array('caf', 'cave', 'caff')),
97-
array('staves', array('staf', 'stave', 'staff')),
98133
array('wives', 'wife'),
99-
array('ions', 'ion'),
100-
array('bases', array('bas', 'base', 'basis')),
101-
array('cars', 'car'),
102-
array('cassettes', array('cassett', 'cassette')),
103-
array('lamps', 'lamp'),
104-
array('hats', 'hat'),
105-
array('cups', 'cup'),
106-
array('boxes', 'box'),
107-
array('sandwiches', array('sandwich', 'sandwiche')),
108-
array('suitcases', array('suitcas', 'suitcase', 'suitcasis')),
109-
array('roses', array('ros', 'rose', 'rosis')),
110-
array('garages', array('garag', 'garage')),
111-
array('shoes', array('sho', 'shoe')),
112-
array('days', 'day'),
113-
array('boys', 'boy'),
114-
array('roofs', 'roof'),
115-
array('cliffs', 'cliff'),
116-
array('sheriffs', 'sheriff'),
117-
array('discos', 'disco'),
118-
array('pianos', 'piano'),
119-
array('photos', 'photo'),
120-
array('trees', array('tre', 'tree')),
121-
array('bees', array('be', 'bee')),
122-
array('cheeses', array('chees', 'cheese', 'cheesis')),
123-
array('radii', 'radius'),
124-
array('objectives', 'objective'),
125-
array('moves', 'move'),
126134

127135
// test casing: if the first letter was uppercase, it should remain so
128136
array('Men', 'Man'),
129137
array('GrandChildren', 'GrandChild'),
130138
array('SubTrees', array('SubTre', 'SubTree')),
139+
140+
// Known issues
141+
//array('insignia', 'insigne'),
142+
//array('insignias', 'insigne'),
143+
//array('rattles', 'rattle'),
131144
);
132145
}
133146

@@ -136,6 +149,13 @@ public function singularifyProvider()
136149
*/
137150
public function testSingularify($plural, $singular)
138151
{
139-
$this->assertEquals($singular, StringUtil::singularify($plural));
152+
$single = StringUtil::singularify($plural);
153+
if (is_string($singular) && is_array($single)) {
154+
$this->fail("--- Expected\n`string`: " . $singular . "\n+++ Actual\n`array`: " . implode(', ', $single));
155+
} elseif (is_array($singular) && is_string($single)) {
156+
$this->fail("--- Expected\n`array`: " . implode(', ', $singular) . "\n+++ Actual\n`string`: " . $single);
157+
}
158+
159+
$this->assertEquals($singular, $single);
140160
}
141161
}

src/Symfony/Component/Stopwatch/.gitattributes

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)