Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8835522

Browse filesBrowse files
committed
Merge branch '3.2'
* 3.2: [ClassLoader] Use only forward slashes in generated class map [VarDumper][HttpKernel] Enhance perf of ExceptionCaster & DataCollector ensure the proper context for nested validations bug symfony#20653 [WebProfilerBundle] Profiler includes ghost panels Fixed getRouteParams() when no parameters are available bumped Symfony version to 3.2.0 updated VERSION for 3.2.0-RC2 updated CHANGELOG for 3.2.0-RC2
2 parents ea7e245 + d5624a6 commit 8835522
Copy full SHA for 8835522

File tree

15 files changed

+162
-63
lines changed
Filter options

15 files changed

+162
-63
lines changed

‎CHANGELOG-3.2.md

Copy file name to clipboardExpand all lines: CHANGELOG-3.2.md
+27Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,33 @@ in 3.2 minor versions.
77
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
88
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v3.2.0...v3.2.1
99

10+
* 3.2.0-RC2 (2016-11-27)
11+
12+
* bug #20601 [FrameworkBundle] Don't rely on any parent definition for "cache.annotations" (nicolas-grekas)
13+
* bug #20638 Fix legacy tests that do not trigger any depreciation (julienfalque)
14+
* bug #20374 [FrameworkBundle] Improve performance of ControllerNameParser (enumag)
15+
* bug #20474 [Routing] Fail properly when a route parameter name cannot be used as a PCRE subpattern name (fancyweb)
16+
* bug #20616 [Bridge/Doctrine] Use cache.prefix.seed parameter for generating cache namespace (nicolas-grekas)
17+
* bug #20566 [DI] Initialize properties before method calls (ro0NL)
18+
* bug #20583 [Workflow] Fixed graphviz dumper for state machine (lyrixx)
19+
* bug #20621 [HttpKernel] Fix exception when serializing request attributes (nicolas-grekas)
20+
* bug #20609 [DI] Fixed custom services definition BC break introduced in ec7e70fb… (kiler129)
21+
* bug #20598 [DI] Aliases should preserve the aliased invalid behavior (nicolas-grekas)
22+
* bug #20600 [Process] Fix process continuing after reached timeout using getIterator() (chalasr)
23+
* bug #20603 [HttpKernel] Deprecate checking for cacheable HTTP methods in Request::isMethodSafe() (nicolas-grekas)
24+
* bug #20602 [HttpKernel] Revert BC breaking change of Request::isMethodSafe() (nicolas-grekas)
25+
* bug #20610 [FrameworkBundle] Add framework.cache.prefix_seed for predictible cache key prefixes (nicolas-grekas)
26+
* bug #20595 [WebProfilerBundle] Fix deprecated uses of profiler_dump (nicolas-grekas)
27+
* bug #20589 [SecurityBundle] Fix FirewallConfig nullable arguments (ogizanagi)
28+
* bug #20590 [DI] Allow null as default env value (sroze)
29+
* bug #20499 [Doctrine][Form] support large integers (xabbuh)
30+
* bug #20559 [FrameworkBundle] Avoid warming up the validator cache for non-existent class (Seldaek)
31+
* bug #20576 [Process] Do feat test before enabling TTY mode (nicolas-grekas)
32+
* bug #20577 [FrameworkBundle] Mark cache.default_*_provider services private (nicolas-grekas)
33+
* bug #20550 [YAML] Fix processing timestamp strings with timezone (myesain)
34+
* bug #20543 [DI] Fix error when trying to resolve a DefinitionDecorator (nicolas-grekas)
35+
* bug #20544 [PhpUnitBridge] Fix time-sensitive tests that use data providers (julienfalque)
36+
1037
* 3.2.0-RC1 (2016-11-17)
1138

1239
* feature #20533 [DI] Revert "deprecate get() for uncompiled container builders" (nicolas-grekas)

‎src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
{% for name, template in templates %}
115115
{% set menu -%}
116116
{% with { collector: profile.getcollector(name), profiler_markup_version: profiler_markup_version } %}
117-
{{ block('menu', template) }}
117+
{{- block('menu', template) -}}
118118
{% endwith %}
119119
{%- endset %}
120120
{% if menu is not empty %}

‎src/Symfony/Component/ClassLoader/ClassCollectionLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/ClassLoader/ClassCollectionLoader.php
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public static function load($classes, $cacheDir, $name, $autoReload, $adaptive =
6060
throw new \RuntimeException(sprintf('Class Collection Loader was not able to create directory "%s"', $cacheDir));
6161
}
6262
$cacheDir = rtrim(realpath($cacheDir) ?: $cacheDir, '/'.DIRECTORY_SEPARATOR);
63-
$cache = $cacheDir.DIRECTORY_SEPARATOR.$name.$extension;
63+
$cache = $cacheDir.'/'.$name.$extension;
6464

6565
// auto-reload
6666
$reload = false;
@@ -140,7 +140,7 @@ public static function inline($classes, $cache, array $excluded)
140140
REGEX;
141141
$dontInlineRegex = str_replace('.', $spacesRegex, $dontInlineRegex);
142142

143-
$cacheDir = explode(DIRECTORY_SEPARATOR, $cacheDir);
143+
$cacheDir = explode('/', str_replace(DIRECTORY_SEPARATOR, '/', $cacheDir));
144144
$files = array();
145145
$content = '';
146146
foreach (self::getOrderedClasses($classes) as $class) {
@@ -153,19 +153,19 @@ public static function inline($classes, $cache, array $excluded)
153153
$c = file_get_contents($file);
154154

155155
if (preg_match($dontInlineRegex, $c)) {
156-
$file = explode(DIRECTORY_SEPARATOR, $file);
156+
$file = explode('/', str_replace(DIRECTORY_SEPARATOR, '/', $file));
157157

158158
for ($i = 0; isset($file[$i], $cacheDir[$i]); ++$i) {
159159
if ($file[$i] !== $cacheDir[$i]) {
160160
break;
161161
}
162162
}
163163
if (1 >= $i) {
164-
$file = var_export(implode(DIRECTORY_SEPARATOR, $file), true);
164+
$file = var_export(implode('/', $file), true);
165165
} else {
166166
$file = array_slice($file, $i);
167-
$file = str_repeat('..'.DIRECTORY_SEPARATOR, count($cacheDir) - $i).implode(DIRECTORY_SEPARATOR, $file);
168-
$file = '__DIR__.'.var_export(DIRECTORY_SEPARATOR.$file, true);
167+
$file = str_repeat('../', count($cacheDir) - $i).implode('/', $file);
168+
$file = '__DIR__.'.var_export('/'.$file, true);
169169
}
170170

171171
$c = "\nnamespace {require $file;}";

‎src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ abstract class DataCollector implements DataCollectorInterface, \Serializable
4242
*/
4343
private $cloner;
4444

45+
private static $stubsCache = array();
46+
4547
public function serialize()
4648
{
4749
return serialize($this->data);
@@ -124,14 +126,17 @@ private function decorateVar($var)
124126
return $var;
125127
}
126128
if (is_string($var)) {
129+
if (isset(self::$stubsCache[$var])) {
130+
return self::$stubsCache[$var];
131+
}
127132
if (false !== strpos($var, '\\')) {
128133
$c = (false !== $i = strpos($var, '::')) ? substr($var, 0, $i) : $var;
129134
if (class_exists($c, false) || interface_exists($c, false) || trait_exists($c, false)) {
130-
return new ClassStub($var);
135+
return self::$stubsCache[$var] = new ClassStub($var);
131136
}
132137
}
133138
if (false !== strpos($var, DIRECTORY_SEPARATOR) && false === strpos($var, '://') && false === strpos($var, "\0") && is_file($var)) {
134-
return new LinkStub($var);
139+
return self::$stubsCache[$var] = new LinkStub($var);
135140
}
136141
}
137142

‎src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,13 @@ public function getRouteParams()
276276
}
277277

278278
$data = $this->data['request_attributes']['_route_params'];
279+
$rawData = $data->getRawData();
280+
if (!isset($rawData[1])) {
281+
return array();
282+
}
283+
279284
$params = array();
280-
foreach ($data->getRawData()[1] as $k => $v) {
285+
foreach ($rawData[1] as $k => $v) {
281286
$params[$k] = $data->seek($k);
282287
}
283288

‎src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php
+12-2Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@ public function testCollect()
5959
$this->assertSame('application/json', $c->getContentType());
6060
}
6161

62+
public function testCollectWithoutRouteParams()
63+
{
64+
$request = $this->createRequest(array());
65+
66+
$c = new RequestDataCollector();
67+
$c->collect($request, $this->createResponse());
68+
69+
$this->assertEquals(array(), $c->getRouteParams());
70+
}
71+
6272
public function testKernelResponseDoesNotStartSession()
6373
{
6474
$kernel = $this->getMock(HttpKernelInterface::class);
@@ -197,12 +207,12 @@ public function testItIgnoresInvalidCallables()
197207
$this->assertSame('n/a', $c->getController());
198208
}
199209

200-
protected function createRequest()
210+
protected function createRequest($routeParams = array('name' => 'foo'))
201211
{
202212
$request = Request::create('http://test.com/foo?bar=baz');
203213
$request->attributes->set('foo', 'bar');
204214
$request->attributes->set('_route', 'foobar');
205-
$request->attributes->set('_route_params', array('name' => 'foo'));
215+
$request->attributes->set('_route_params', $routeParams);
206216
$request->attributes->set('resource', fopen(__FILE__, 'r'));
207217
$request->attributes->set('object', new \stdClass());
208218

‎src/Symfony/Component/Validator/Context/ExecutionContext.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Context/ExecutionContext.php
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,11 @@ public function getGroup()
269269
return $this->group;
270270
}
271271

272+
public function getConstraint()
273+
{
274+
return $this->constraint;
275+
}
276+
272277
/**
273278
* {@inheritdoc}
274279
*/

‎src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Validator\Tests\Validator;
1313

1414
use Symfony\Component\Validator\Constraints\Callback;
15+
use Symfony\Component\Validator\Constraints\Collection;
1516
use Symfony\Component\Validator\Constraints\GroupSequence;
1617
use Symfony\Component\Validator\Constraints\NotNull;
1718
use Symfony\Component\Validator\Constraints\Traverse;
@@ -651,4 +652,22 @@ public function testPassConstraintToViolation()
651652
$this->assertCount(1, $violations);
652653
$this->assertSame($constraint, $violations[0]->getConstraint());
653654
}
655+
656+
public function testCollectionConstraitViolationHasCorrectContext()
657+
{
658+
$data = array(
659+
'foo' => 'fooValue',
660+
);
661+
662+
// Missing field must not be the first in the collection validation
663+
$constraint = new Collection(array(
664+
'foo' => new NotNull(),
665+
'bar' => new NotNull(),
666+
));
667+
668+
$violations = $this->validate($data, $constraint);
669+
670+
$this->assertCount(1, $violations);
671+
$this->assertSame($constraint, $violations[0]->getConstraint());
672+
}
654673
}

‎src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\Validator\Constraint;
1515
use Symfony\Component\Validator\Constraints\GroupSequence;
1616
use Symfony\Component\Validator\ConstraintValidatorFactoryInterface;
17+
use Symfony\Component\Validator\Context\ExecutionContext;
1718
use Symfony\Component\Validator\Context\ExecutionContextInterface;
1819
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
1920
use Symfony\Component\Validator\Exception\NoSuchMetadataException;
@@ -110,6 +111,11 @@ public function validate($value, $constraints = null, $groups = null)
110111
$previousMetadata = $this->context->getMetadata();
111112
$previousPath = $this->context->getPropertyPath();
112113
$previousGroup = $this->context->getGroup();
114+
$previousConstraint = null;
115+
116+
if ($this->context instanceof ExecutionContext || method_exists($this->context, 'getConstraint')) {
117+
$previousConstraint = $this->context->getConstraint();
118+
}
113119

114120
// If explicit constraints are passed, validate the value against
115121
// those constraints
@@ -138,6 +144,10 @@ public function validate($value, $constraints = null, $groups = null)
138144
$this->context->setNode($previousValue, $previousObject, $previousMetadata, $previousPath);
139145
$this->context->setGroup($previousGroup);
140146

147+
if (null !== $previousConstraint) {
148+
$this->context->setConstraint($previousConstraint);
149+
}
150+
141151
return $this;
142152
}
143153

‎src/Symfony/Component/VarDumper/Caster/Caster.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Caster/Caster.php
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,20 @@ public static function castObject($obj, \ReflectionClass $reflector)
5757
}
5858

5959
if ($a) {
60+
$combine = false;
6061
$p = array_keys($a);
6162
foreach ($p as $i => $k) {
6263
if (isset($k[0]) && "\0" !== $k[0] && !$reflector->hasProperty($k)) {
64+
$combine = true;
6365
$p[$i] = self::PREFIX_DYNAMIC.$k;
6466
} elseif (isset($k[16]) && "\0" === $k[16] && 0 === strpos($k, "\0class@anonymous\0")) {
67+
$combine = true;
6568
$p[$i] = "\0".$reflector->getParentClass().'@anonymous'.strrchr($k, "\0");
6669
}
6770
}
68-
$a = array_combine($p, $a);
71+
if ($combine) {
72+
$a = array_combine($p, $a);
73+
}
6974
}
7075

7176
return $a;

‎src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php
+49-37Lines changed: 49 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ class ExceptionCaster
4141
E_STRICT => 'E_STRICT',
4242
);
4343

44+
private static $framesCache = array();
45+
4446
public static function castError(\Error $e, array $a, Stub $stub, $isNested, $filter = 0)
4547
{
4648
return self::filterExceptionArray($stub->class, $a, "\0Error\0", $filter);
@@ -142,43 +144,52 @@ public static function castFrameStub(FrameStub $frame, array $a, Stub $stub, $is
142144
$prefix = Caster::PREFIX_VIRTUAL;
143145

144146
if (isset($f['file'], $f['line'])) {
145-
if (preg_match('/\((\d+)\)(?:\([\da-f]{32}\))? : (?:eval\(\)\'d code|runtime-created function)$/', $f['file'], $match)) {
146-
$f['file'] = substr($f['file'], 0, -strlen($match[0]));
147-
$f['line'] = (int) $match[1];
148-
}
149-
$caller = isset($f['function']) ? sprintf('in %s() on line %d', (isset($f['class']) ? $f['class'].$f['type'] : '').$f['function'], $f['line']) : null;
150-
$src = $f['line'];
151-
$srcKey = $f['file'];
152-
$ellipsis = explode(DIRECTORY_SEPARATOR, $srcKey);
153-
$ellipsis = 3 < count($ellipsis) ? 2 + strlen(implode(array_slice($ellipsis, -2))) : 0;
154-
155-
if (file_exists($f['file']) && 0 <= self::$srcContext) {
156-
if (!empty($f['class']) && is_subclass_of($f['class'], 'Twig_Template') && method_exists($f['class'], 'getDebugInfo')) {
157-
$template = isset($f['object']) ? $f['object'] : unserialize(sprintf('O:%d:"%s":0:{}', strlen($f['class']), $f['class']));
158-
159-
$ellipsis = 0;
160-
$templateSrc = method_exists($template, 'getSourceContext') ? $template->getSourceContext()->getCode() : (method_exists($template, 'getSource') ? $template->getSource() : '');
161-
$templateInfo = $template->getDebugInfo();
162-
if (isset($templateInfo[$f['line']])) {
163-
$templatePath = method_exists($template, 'getSourceContext') ? $template->getSourceContext()->getPath() : null;
164-
165-
if ($templateSrc) {
166-
$templateSrc = explode("\n", $templateSrc);
167-
$src = self::extractSource($templateSrc, $templateInfo[$f['line']], self::$srcContext, $caller, 'twig', $templatePath);
168-
$srcKey = ($templatePath ?: $template->getTemplateName()).':'.$templateInfo[$f['line']];
147+
$cacheKey = $f;
148+
unset($cacheKey['object'], $cacheKey['args']);
149+
$cacheKey[] = self::$srcContext;
150+
$cacheKey = implode('-', $cacheKey);
151+
152+
if (isset(self::$framesCache[$cacheKey])) {
153+
$a[$prefix.'src'] = self::$framesCache[$cacheKey];
154+
} else {
155+
if (preg_match('/\((\d+)\)(?:\([\da-f]{32}\))? : (?:eval\(\)\'d code|runtime-created function)$/', $f['file'], $match)) {
156+
$f['file'] = substr($f['file'], 0, -strlen($match[0]));
157+
$f['line'] = (int) $match[1];
158+
}
159+
$caller = isset($f['function']) ? sprintf('in %s() on line %d', (isset($f['class']) ? $f['class'].$f['type'] : '').$f['function'], $f['line']) : null;
160+
$src = $f['line'];
161+
$srcKey = $f['file'];
162+
$ellipsis = explode(DIRECTORY_SEPARATOR, $srcKey);
163+
$ellipsis = 3 < count($ellipsis) ? 2 + strlen(implode(array_slice($ellipsis, -2))) : 0;
164+
165+
if (file_exists($f['file']) && 0 <= self::$srcContext) {
166+
if (!empty($f['class']) && is_subclass_of($f['class'], 'Twig_Template') && method_exists($f['class'], 'getDebugInfo')) {
167+
$template = isset($f['object']) ? $f['object'] : unserialize(sprintf('O:%d:"%s":0:{}', strlen($f['class']), $f['class']));
168+
169+
$ellipsis = 0;
170+
$templateSrc = method_exists($template, 'getSourceContext') ? $template->getSourceContext()->getCode() : (method_exists($template, 'getSource') ? $template->getSource() : '');
171+
$templateInfo = $template->getDebugInfo();
172+
if (isset($templateInfo[$f['line']])) {
173+
if (!method_exists($template, 'getSourceContext') || !file_exists($templatePath = $template->getSourceContext()->getPath())) {
174+
$templatePath = null;
175+
}
176+
if ($templateSrc) {
177+
$src = self::extractSource($templateSrc, $templateInfo[$f['line']], self::$srcContext, $caller, 'twig', $templatePath);
178+
$srcKey = ($templatePath ?: $template->getTemplateName()).':'.$templateInfo[$f['line']];
179+
}
169180
}
170181
}
171-
}
172-
if ($srcKey == $f['file']) {
173-
$src = self::extractSource(explode("\n", file_get_contents($f['file'])), $f['line'], self::$srcContext, $caller, 'php', $f['file']);
174-
$srcKey .= ':'.$f['line'];
175-
if ($ellipsis) {
176-
$ellipsis += 1 + strlen($f['line']);
182+
if ($srcKey == $f['file']) {
183+
$src = self::extractSource(file_get_contents($f['file']), $f['line'], self::$srcContext, $caller, 'php', $f['file']);
184+
$srcKey .= ':'.$f['line'];
185+
if ($ellipsis) {
186+
$ellipsis += 1 + strlen($f['line']);
187+
}
177188
}
178189
}
190+
$srcAttr = $ellipsis ? 'ellipsis='.$ellipsis : '';
191+
self::$framesCache[$cacheKey] = $a[$prefix.'src'] = new EnumStub(array("\0~$srcAttr\0$srcKey" => $src));
179192
}
180-
$srcAttr = $ellipsis ? 'ellipsis='.$ellipsis : '';
181-
$a[$prefix.'src'] = new EnumStub(array("\0~$srcAttr\0$srcKey" => $src));
182193
}
183194

184195
unset($a[$prefix.'args'], $a[$prefix.'line'], $a[$prefix.'file']);
@@ -232,14 +243,16 @@ private static function traceUnshift(&$trace, $class, $file, $line)
232243
));
233244
}
234245

235-
private static function extractSource(array $srcArray, $line, $srcContext, $title, $lang, $file = null)
246+
private static function extractSource($srcLines, $line, $srcContext, $title, $lang, $file = null)
236247
{
248+
$srcLines = explode("\n", $srcLines);
237249
$src = array();
238250

239251
for ($i = $line - 1 - $srcContext; $i <= $line - 1 + $srcContext; ++$i) {
240-
$src[] = (isset($srcArray[$i]) ? $srcArray[$i] : '')."\n";
252+
$src[] = (isset($srcLines[$i]) ? $srcLines[$i] : '')."\n";
241253
}
242254

255+
$srcLines = array();
243256
$ltrim = 0;
244257
do {
245258
$pad = null;
@@ -257,7 +270,6 @@ private static function extractSource(array $srcArray, $line, $srcContext, $titl
257270
} while (0 > $i && null !== $pad);
258271

259272
--$ltrim;
260-
$srcArray = array();
261273

262274
foreach ($src as $i => $c) {
263275
if ($ltrim) {
@@ -274,9 +286,9 @@ private static function extractSource(array $srcArray, $line, $srcContext, $titl
274286
}
275287
}
276288
$c->attr['lang'] = $lang;
277-
$srcArray[sprintf("\0~%d\0", $i + $line - $srcContext)] = $c;
289+
$srcLines[sprintf("\0~%d\0", $i + $line - $srcContext)] = $c;
278290
}
279291

280-
return new EnumStub($srcArray);
292+
return new EnumStub($srcLines);
281293
}
282294
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.