Skip to content

Commit 5cb0ad3

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: [Yaml] fix exception contexts People - person singularization [Yaml] properly handle unindented collections [Serializer] Add test for ignored attributes during denormalization chomp newlines only at the end of YAML documents Fixed server status command when port has been omitted Update UPGRADE FROM 2.x to 3.0 Catch \Throwable Use levenshtein level for better Bundle matching [WebProfilerBundle] Fix CORS ajax security issues
2 parents eff863b + eac5868 commit 5cb0ad3

File tree

14 files changed

+126
-21
lines changed

14 files changed

+126
-21
lines changed

UPGRADE-3.0.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,11 @@ UPGRADE FROM 2.x to 3.0
365365
</service>
366366
```
367367

368-
* The `ChoiceToBooleanArrayTransformer`, `ChoicesToBooleanArrayTransformer`,
369-
`FixRadioInputListener`, and `FixCheckboxInputListener` classes were removed.
368+
* The `max_length` option was removed. Use the `attr` option instead by setting it to
369+
an `array` with a `maxlength` key.
370+
371+
* The `ChoiceToBooleanArrayTransformer`, `ChoicesToBooleanArrayTransformer`,
372+
`FixRadioInputListener`, and `FixCheckboxInputListener` classes were removed.
370373

371374
* The `choice_list` option of `ChoiceType` was removed.
372375

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\Console\Input\InputArgument;
1515
use Symfony\Component\Console\Input\InputInterface;
16+
use Symfony\Component\Console\Input\InputOption;
1617
use Symfony\Component\Console\Output\OutputInterface;
1718
use Symfony\Component\Console\Style\SymfonyStyle;
1819

@@ -32,6 +33,7 @@ protected function configure()
3233
$this
3334
->setDefinition(array(
3435
new InputArgument('address', InputArgument::OPTIONAL, 'Address:port', '127.0.0.1:8000'),
36+
new InputOption('port', 'p', InputOption::VALUE_REQUIRED, 'Address port number', '8000'),
3537
))
3638
->setName('server:status')
3739
->setDescription('Outputs the status of the built-in web server for the given address')
@@ -46,6 +48,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
4648
$io = new SymfonyStyle($input, $output);
4749
$address = $input->getArgument('address');
4850

51+
if (false === strpos($address, ':')) {
52+
$address = $address.':'.$input->getOption('port');
53+
}
54+
4955
// remove an orphaned lock file
5056
if (file_exists($this->getLockFile($address)) && !$this->isServerRunning($address)) {
5157
unlink($this->getLockFile($address));

src/Symfony/Bundle/FrameworkBundle/Controller/ControllerNameParser.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ private function findAlternative($nonExistentBundleName)
142142
$lev = levenshtein($nonExistentBundleName, $bundleName);
143143
if ($lev <= strlen($nonExistentBundleName) / 3 && ($alternative === null || $lev < $shortest)) {
144144
$alternative = $bundleName;
145+
$shortest = $lev;
145146
}
146147
}
147148

src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ public function testBuild()
5959
{
6060
$parser = $this->createParser();
6161

62-
$this->assertEquals('FooBundle:Default:index', $parser->build('TestBundle\FooBundle\Controller\DefaultController::indexAction'), '->parse() converts a class::method string to a short a:b:c notation string');
63-
$this->assertEquals('FooBundle:Sub\Default:index', $parser->build('TestBundle\FooBundle\Controller\Sub\DefaultController::indexAction'), '->parse() converts a class::method string to a short a:b:c notation string');
62+
$this->assertEquals('FoooooBundle:Default:index', $parser->build('TestBundle\FooBundle\Controller\DefaultController::indexAction'), '->parse() converts a class::method string to a short a:b:c notation string');
63+
$this->assertEquals('FoooooBundle:Sub\Default:index', $parser->build('TestBundle\FooBundle\Controller\Sub\DefaultController::indexAction'), '->parse() converts a class::method string to a short a:b:c notation string');
6464

6565
try {
6666
$parser->build('TestBundle\FooBundle\Controller\DefaultController::index');
@@ -132,8 +132,9 @@ public function testInvalidBundleName($bundleName, $suggestedBundleName)
132132
public function getInvalidBundleNameTests()
133133
{
134134
return array(
135-
array('FoodBundle:Default:index', 'FooBundle:Default:index'),
136-
array('CrazyBundle:Default:index', false),
135+
'Alternative will be found using levenshtein' => array('FoodBundle:Default:index', 'FooBundle:Default:index'),
136+
'Alternative will be found using partial match' => array('FabpotFooBund:Default:index', 'FabpotFooBundle:Default:index'),
137+
'Bundle does not exist at all' => array('CrazyBundle:Default:index', false),
137138
);
138139
}
139140

@@ -162,6 +163,7 @@ private function createParser()
162163
$bundles = array(
163164
'SensioFooBundle' => $this->getBundle('TestBundle\Fabpot\FooBundle', 'FabpotFooBundle'),
164165
'SensioCmsFooBundle' => $this->getBundle('TestBundle\Sensio\Cms\FooBundle', 'SensioCmsFooBundle'),
166+
'FoooooBundle' => $this->getBundle('TestBundle\FooBundle', 'FoooooBundle'),
165167
'FooBundle' => $this->getBundle('TestBundle\FooBundle', 'FooBundle'),
166168
'FabpotFooBundle' => $this->getBundle('TestBundle\Fabpot\FooBundle', 'FabpotFooBundle'),
167169
);

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,20 @@
8282
8383
requestStack = [],
8484
85+
extractHeaders = function(xhr, stackElement) {
86+
// Here we avoid to call xhr.getResponseHeader in order to
87+
// prevent polluting the console with CORS security errors
88+
var allHeaders = xhr.getAllResponseHeaders();
89+
var ret;
90+
91+
if (ret = allHeaders.match(/^x-debug-token:\s+(.*)$/im)) {
92+
stackElement.profile = ret[1];
93+
}
94+
if (ret = allHeaders.match(/^x-debug-token-link:\s+(.*)$/im)) {
95+
stackElement.profilerUrl = ret[1];
96+
}
97+
},
98+
8599
renderAjaxRequests = function() {
86100
var requestCounter = document.querySelectorAll('.sf-toolbar-ajax-requests');
87101
if (!requestCounter.length) {
@@ -241,8 +255,8 @@
241255
stackElement.duration = new Date() - stackElement.start;
242256
stackElement.loading = false;
243257
stackElement.error = self.status < 200 || self.status >= 400;
244-
stackElement.profile = self.getResponseHeader("X-Debug-Token");
245-
stackElement.profilerUrl = self.getResponseHeader("X-Debug-Token-Link");
258+
259+
extractHeaders(self, stackElement);
246260
247261
Sfjs.renderAjaxRequests();
248262
}

src/Symfony/Component/Debug/DebugClassLoader.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ public function loadClass($class)
175175
} catch (\Exception $e) {
176176
ErrorHandler::unstackErrors();
177177

178+
throw $e;
179+
} catch (\Throwable $e) {
180+
ErrorHandler::unstackErrors();
181+
178182
throw $e;
179183
}
180184

src/Symfony/Component/Debug/ErrorHandler.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,10 @@ public function handleError($type, $message, $file, $line, array $context, array
517517
} catch (\Exception $e) {
518518
$this->isRecursive = false;
519519

520+
throw $e;
521+
} catch (\Throwable $e) {
522+
$this->isRecursive = false;
523+
520524
throw $e;
521525
}
522526
}
@@ -625,6 +629,8 @@ public static function handleFatalError(array $error = null)
625629
}
626630
} catch (\Exception $exception) {
627631
// Handled below
632+
} catch (\Throwable $exception) {
633+
// Handled below
628634
}
629635

630636
if ($error && $error['type'] &= E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR) {

src/Symfony/Component/OptionsResolver/OptionsResolver.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,9 @@ public function offsetGet($option)
861861
} catch (\Exception $e) {
862862
unset($this->calling[$option]);
863863
throw $e;
864+
} catch (\Throwable $e) {
865+
unset($this->calling[$option]);
866+
throw $e;
864867
}
865868
unset($this->calling[$option]);
866869
// END
@@ -963,6 +966,9 @@ public function offsetGet($option)
963966
} catch (\Exception $e) {
964967
unset($this->calling[$option]);
965968
throw $e;
969+
} catch (\Throwable $e) {
970+
unset($this->calling[$option]);
971+
throw $e;
966972
}
967973
unset($this->calling[$option]);
968974
// END

src/Symfony/Component/PropertyAccess/StringUtil.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ class StringUtil
124124

125125
// chateaux (chateau)
126126
array('xuae', 4, false, true, 'eau'),
127+
128+
// people (person)
129+
array('elpoep', 6, true, true, 'person'),
127130
);
128131

129132
/**

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ public function singularifyProvider()
107107
array('objectives', 'objective'),
108108
array('oxen', 'ox'),
109109
array('parties', 'party'),
110+
array('people', 'person'),
111+
array('persons', 'person'),
110112
array('phenomena', array('phenomenon', 'phenomenum')),
111113
array('photos', 'photo'),
112114
array('pianos', 'piano'),

0 commit comments

Comments
 (0)