Skip to content

Commit d65adc0

Browse files
committed
Merge branch '2.6' into 2.7
* 2.6: Improve the config validation in TwigBundle [WebProfilerBundle][logger] added missing deprecation message. [Security][Acl] enforce string identifiers [BrowserKit] Fix bug when uri starts with http. bumped Symfony version to 2.3.31 updated VERSION for 2.3.30 updated CHANGELOG for 2.3.30 Php Inspections (EA Extended): - resolved possible PHP Fatal in \Symfony\Component\BrowserKit\Cookie::__toString -resolved implicit magic methods calls -resolved callable name case mismatches
2 parents e8d06b2 + 1c4c043 commit d65adc0

File tree

25 files changed

+95
-50
lines changed

25 files changed

+95
-50
lines changed

CHANGELOG-2.3.md

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ in 2.3 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/v2.3.0...v2.3.1
99

10+
* 2.3.30 (2015-05-30)
11+
12+
* bug #14262 [REVERTED] [TwigBundle] Refresh twig paths when resources change. (aitboudad)
13+
1014
* 2.3.29 (2015-05-26)
1115

1216
* security #14759 CVE-2015-4050 [HttpKernel] Do not call the FragmentListener if _controller is already defined (jakzal)

src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,13 @@ private function addTwigOptions(ArrayNodeDefinition $rootNode)
170170
->variableNode('autoescape')->defaultValue('filename')->end()
171171
->scalarNode('autoescape_service')->defaultNull()->end()
172172
->scalarNode('autoescape_service_method')->defaultNull()->end()
173-
->scalarNode('base_template_class')->example('Twig_Template')->end()
173+
->scalarNode('base_template_class')->example('Twig_Template')->cannotBeEmpty()->end()
174174
->scalarNode('cache')->defaultValue('%kernel.cache_dir%/twig')->end()
175175
->scalarNode('charset')->defaultValue('%kernel.charset%')->end()
176-
->scalarNode('debug')->defaultValue('%kernel.debug%')->end()
177-
->scalarNode('strict_variables')->end()
176+
->booleanNode('debug')->defaultValue('%kernel.debug%')->end()
177+
->booleanNode('strict_variables')->end()
178178
->scalarNode('auto_reload')->end()
179-
->scalarNode('optimizations')->end()
179+
->integerNode('optimizations')->min(-1)->end()
180180
->arrayNode('paths')
181181
->normalizeKeys(false)
182182
->useAttributeAsKey('paths')

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig

+2-1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@
110110

111111

112112
{% macro display_message(log_index, log, is_deprecation) %}
113+
{{ is_deprecation ? 'DEPRECATED' : log.priorityName }} - {{ log.message }}
114+
113115
{% if is_deprecation %}
114116
{% set stack = log.context.stack|default([]) %}
115117
{% set id = 'sf-call-stack-' ~ log_index %}
@@ -144,7 +146,6 @@
144146
{% endif %}
145147
{% endfor %}
146148
{% else %}
147-
{{ log.priorityName }} - {{ log.message }}
148149
{% if log.context is defined and log.context is not empty %}
149150
<br />
150151
<small>

src/Symfony/Component/BrowserKit/Client.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ public function restart()
547547
protected function getAbsoluteUri($uri)
548548
{
549549
// already absolute?
550-
if (0 === strpos($uri, 'http')) {
550+
if (0 === strpos($uri, 'http://') || 0 === strpos($uri, 'https://')) {
551551
return $uri;
552552
}
553553

src/Symfony/Component/BrowserKit/Cookie.php

+10-7
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,20 @@ public function __construct($name, $value, $expires = null, $path = null, $domai
6969
$this->rawValue = urlencode($value);
7070
}
7171
$this->name = $name;
72-
$this->expires = null === $expires ? null : (int) $expires;
7372
$this->path = empty($path) ? '/' : $path;
7473
$this->domain = $domain;
7574
$this->secure = (bool) $secure;
7675
$this->httponly = (bool) $httponly;
76+
77+
if (null !== $expires) {
78+
$timestampAsDateTime = \DateTime::createFromFormat('U', $expires);
79+
if (false === $timestampAsDateTime) {
80+
throw new \UnexpectedValueException(sprintf('The cookie expiration time "%s" is not valid.'), $expires);
81+
}
82+
83+
$this->expires = $timestampAsDateTime->getTimestamp();
84+
}
85+
7786
}
7887

7988
/**
@@ -91,12 +100,6 @@ public function __toString()
91100

92101
if (null !== $this->expires) {
93102
$dateTime = \DateTime::createFromFormat('U', $this->expires, new \DateTimeZone('GMT'));
94-
95-
if ($dateTime === false) {
96-
// this throw will provoke PHP fatal
97-
throw new \UnexpectedValueException(sprintf('The cookie expiration time "%s" is not valid.'), $this->expires);
98-
}
99-
100103
$cookie .= '; expires='.str_replace('+0000', '', $dateTime->format(self::$dateFormats[0]));
101104
}
102105

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

+19-4
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,21 @@ public function testRequestURIConversion()
207207
$client->request('GET', 'http://www.example.com/foo/foobar');
208208
$client->request('GET', 'bar');
209209
$this->assertEquals('http://www.example.com/foo/bar', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
210+
211+
$client = new TestClient();
212+
$client->request('GET', 'http://www.example.com/foo/');
213+
$client->request('GET', 'http');
214+
$this->assertEquals('http://www.example.com/foo/http', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
215+
216+
$client = new TestClient();
217+
$client->request('GET', 'http://www.example.com/foo');
218+
$client->request('GET', 'http/bar');
219+
$this->assertEquals('http://www.example.com/http/bar', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
220+
221+
$client = new TestClient();
222+
$client->request('GET', 'http://www.example.com/');
223+
$client->request('GET', 'http');
224+
$this->assertEquals('http://www.example.com/http', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
210225
}
211226

212227
public function testRequestURIConversionByServerHost()
@@ -332,7 +347,7 @@ public function testFollowRedirect()
332347
$client->followRedirect();
333348
$this->fail('->followRedirect() throws a \LogicException if the request was not redirected');
334349
} catch (\Exception $e) {
335-
$this->assertInstanceof('LogicException', $e, '->followRedirect() throws a \LogicException if the request was not redirected');
350+
$this->assertInstanceOf('LogicException', $e, '->followRedirect() throws a \LogicException if the request was not redirected');
336351
}
337352

338353
$client->setNextResponse(new Response('', 302, array('Location' => 'http://www.example.com/redirected')));
@@ -362,7 +377,7 @@ public function testFollowRedirect()
362377
$client->followRedirect();
363378
$this->fail('->followRedirect() throws a \LogicException if the request did not respond with 30x HTTP Code');
364379
} catch (\Exception $e) {
365-
$this->assertInstanceof('LogicException', $e, '->followRedirect() throws a \LogicException if the request did not respond with 30x HTTP Code');
380+
$this->assertInstanceOf('LogicException', $e, '->followRedirect() throws a \LogicException if the request did not respond with 30x HTTP Code');
366381
}
367382
}
368383

@@ -392,7 +407,7 @@ public function testFollowRedirectWithMaxRedirects()
392407
$client->followRedirect();
393408
$this->fail('->followRedirect() throws a \LogicException if the request was redirected and limit of redirections was reached');
394409
} catch (\Exception $e) {
395-
$this->assertInstanceof('LogicException', $e, '->followRedirect() throws a \LogicException if the request was redirected and limit of redirections was reached');
410+
$this->assertInstanceOf('LogicException', $e, '->followRedirect() throws a \LogicException if the request was redirected and limit of redirections was reached');
396411
}
397412

398413
$client->setNextResponse(new Response('', 302, array('Location' => 'http://www.example.com/redirected')));
@@ -562,7 +577,7 @@ public function testInsulatedRequests()
562577
$client->request('GET', 'http://www.example.com/foo/foobar');
563578
$this->fail('->request() throws a \RuntimeException if the script has an error');
564579
} catch (\Exception $e) {
565-
$this->assertInstanceof('RuntimeException', $e, '->request() throws a \RuntimeException if the script has an error');
580+
$this->assertInstanceOf('RuntimeException', $e, '->request() throws a \RuntimeException if the script has an error');
566581
}
567582
}
568583

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

+9-9
Original file line numberDiff line numberDiff line change
@@ -74,30 +74,30 @@ public function testFromStringWithCapitalization()
7474

7575
public function testFromStringWithUrl()
7676
{
77-
$this->assertEquals('foo=bar; domain=www.example.com; path=/', (string) Cookie::FromString('foo=bar', 'http://www.example.com/'));
78-
$this->assertEquals('foo=bar; domain=www.example.com; path=/', (string) Cookie::FromString('foo=bar', 'http://www.example.com'));
79-
$this->assertEquals('foo=bar; domain=www.example.com; path=/', (string) Cookie::FromString('foo=bar', 'http://www.example.com?foo'));
80-
$this->assertEquals('foo=bar; domain=www.example.com; path=/foo', (string) Cookie::FromString('foo=bar', 'http://www.example.com/foo/bar'));
81-
$this->assertEquals('foo=bar; domain=www.example.com; path=/', (string) Cookie::FromString('foo=bar; path=/', 'http://www.example.com/foo/bar'));
82-
$this->assertEquals('foo=bar; domain=www.myotherexample.com; path=/', (string) Cookie::FromString('foo=bar; domain=www.myotherexample.com', 'http://www.example.com/'));
77+
$this->assertEquals('foo=bar; domain=www.example.com; path=/', (string) Cookie::fromString('foo=bar', 'http://www.example.com/'));
78+
$this->assertEquals('foo=bar; domain=www.example.com; path=/', (string) Cookie::fromString('foo=bar', 'http://www.example.com'));
79+
$this->assertEquals('foo=bar; domain=www.example.com; path=/', (string) Cookie::fromString('foo=bar', 'http://www.example.com?foo'));
80+
$this->assertEquals('foo=bar; domain=www.example.com; path=/foo', (string) Cookie::fromString('foo=bar', 'http://www.example.com/foo/bar'));
81+
$this->assertEquals('foo=bar; domain=www.example.com; path=/', (string) Cookie::fromString('foo=bar; path=/', 'http://www.example.com/foo/bar'));
82+
$this->assertEquals('foo=bar; domain=www.myotherexample.com; path=/', (string) Cookie::fromString('foo=bar; domain=www.myotherexample.com', 'http://www.example.com/'));
8383
}
8484

8585
public function testFromStringThrowsAnExceptionIfCookieIsNotValid()
8686
{
8787
$this->setExpectedException('InvalidArgumentException');
88-
Cookie::FromString('foo');
88+
Cookie::fromString('foo');
8989
}
9090

9191
public function testFromStringThrowsAnExceptionIfCookieDateIsNotValid()
9292
{
9393
$this->setExpectedException('InvalidArgumentException');
94-
Cookie::FromString('foo=bar; expires=Flursday July 31st 2020, 08:49:37 GMT');
94+
Cookie::fromString('foo=bar; expires=Flursday July 31st 2020, 08:49:37 GMT');
9595
}
9696

9797
public function testFromStringThrowsAnExceptionIfUrlIsNotValid()
9898
{
9999
$this->setExpectedException('InvalidArgumentException');
100-
Cookie::FromString('foo=bar', 'foobar');
100+
Cookie::fromString('foo=bar', 'foobar');
101101
}
102102

103103
public function testGetName()

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function testCurrent()
5454
$history->current();
5555
$this->fail('->current() throws a \LogicException if the history is empty');
5656
} catch (\Exception $e) {
57-
$this->assertInstanceof('LogicException', $e, '->current() throws a \LogicException if the history is empty');
57+
$this->assertInstanceOf('LogicException', $e, '->current() throws a \LogicException if the history is empty');
5858
}
5959

6060
$history->add(new Request('http://www.example.com/', 'get'));
@@ -71,7 +71,7 @@ public function testBack()
7171
$history->back();
7272
$this->fail('->back() throws a \LogicException if the history is already on the first page');
7373
} catch (\Exception $e) {
74-
$this->assertInstanceof('LogicException', $e, '->current() throws a \LogicException if the history is already on the first page');
74+
$this->assertInstanceOf('LogicException', $e, '->current() throws a \LogicException if the history is already on the first page');
7575
}
7676

7777
$history->add(new Request('http://www.example1.com/', 'get'));
@@ -90,7 +90,7 @@ public function testForward()
9090
$history->forward();
9191
$this->fail('->forward() throws a \LogicException if the history is already on the last page');
9292
} catch (\Exception $e) {
93-
$this->assertInstanceof('LogicException', $e, '->forward() throws a \LogicException if the history is already on the last page');
93+
$this->assertInstanceOf('LogicException', $e, '->forward() throws a \LogicException if the history is already on the last page');
9494
}
9595

9696
$history->back();

src/Symfony/Component/Finder/Tests/FinderTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ public function testSortByModifiedTime($adapter)
262262
public function testSort($adapter)
263263
{
264264
$finder = $this->buildFinder($adapter);
265-
$this->assertSame($finder, $finder->sort(function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($a->getRealpath(), $b->getRealpath()); }));
265+
$this->assertSame($finder, $finder->sort(function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($a->getRealPath(), $b->getRealPath()); }));
266266
$this->assertIterator($this->toAbsolute(array('foo', 'foo bar', 'foo/bar.tmp', 'test.php', 'test.py', 'toto')), $finder->in(self::$tmpDir)->getIterator());
267267
}
268268

src/Symfony/Component/Finder/Tests/Iterator/SortableIteratorTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public function getAcceptData()
163163
array(SortableIterator::SORT_BY_ACCESSED_TIME, $this->toAbsolute($sortByAccessedTime)),
164164
array(SortableIterator::SORT_BY_CHANGED_TIME, $this->toAbsolute($sortByChangedTime)),
165165
array(SortableIterator::SORT_BY_MODIFIED_TIME, $this->toAbsolute($sortByModifiedTime)),
166-
array(function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($a->getRealpath(), $b->getRealpath()); }, $this->toAbsolute($customComparison)),
166+
array(function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($a->getRealPath(), $b->getRealPath()); }, $this->toAbsolute($customComparison)),
167167
);
168168
}
169169
}

src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ public function reverseTransform($value)
215215
}
216216

217217
if ($this->inputTimezone !== $this->outputTimezone) {
218-
$dateTime->setTimeZone(new \DateTimeZone($this->inputTimezone));
218+
$dateTime->setTimezone(new \DateTimeZone($this->inputTimezone));
219219
}
220220
} catch (TransformationFailedException $e) {
221221
throw $e;

src/Symfony/Component/Form/Tests/AbstractLayoutTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ protected function assertMatchesXpath($html, $expression, $count = 1)
6161
try {
6262
// Wrap in <root> node so we can load HTML with multiple tags at
6363
// the top level
64-
$dom->loadXml('<root>'.$html.'</root>');
64+
$dom->loadXML('<root>'.$html.'</root>');
6565
} catch (\Exception $e) {
6666
$this->fail(sprintf(
6767
"Failed loading HTML:\n\n%s\n\nError: %s",

src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public function testReverseTransformWithDifferentTimezones()
140140

141141
$output = new \DateTime('2010-02-03 16:05:06 Asia/Hong_Kong');
142142
$input = $output->format('Y-m-d H:i:s');
143-
$output->setTimeZone(new \DateTimeZone('America/New_York'));
143+
$output->setTimezone(new \DateTimeZone('America/New_York'));
144144

145145
$this->assertDateTimeEquals($output, $reverseTransformer->reverseTransform($input));
146146
}

src/Symfony/Component/HttpFoundation/Response.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1080,7 +1080,7 @@ public function isNotModified(Request $request)
10801080
$lastModified = $this->headers->get('Last-Modified');
10811081
$modifiedSince = $request->headers->get('If-Modified-Since');
10821082

1083-
if ($etags = $request->getEtags()) {
1083+
if ($etags = $request->getETags()) {
10841084
$notModified = in_array($this->getEtag(), $etags) || in_array('*', $etags);
10851085
}
10861086

src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public function testXAccelMapping($realpath, $mapping, $virtual)
179179

180180
$file = new FakeFile($realpath, __DIR__.'/File/Fixtures/test');
181181

182-
BinaryFileResponse::trustXSendFileTypeHeader();
182+
BinaryFileResponse::trustXSendfileTypeHeader();
183183
$response = new BinaryFileResponse($file);
184184
$reflection = new \ReflectionObject($response);
185185
$property = $reflection->getProperty('file');

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public function collect(Request $request, Response $response, \Exception $except
129129
$this->data['controller'] = array(
130130
'class' => is_object($controller[0]) ? get_class($controller[0]) : $controller[0],
131131
'method' => $controller[1],
132-
'file' => $r->getFilename(),
132+
'file' => $r->getFileName(),
133133
'line' => $r->getStartLine(),
134134
);
135135
} catch (\ReflectionException $re) {
@@ -148,7 +148,7 @@ public function collect(Request $request, Response $response, \Exception $except
148148
$this->data['controller'] = array(
149149
'class' => $r->getName(),
150150
'method' => null,
151-
'file' => $r->getFilename(),
151+
'file' => $r->getFileName(),
152152
'line' => $r->getStartLine(),
153153
);
154154
} elseif (is_object($controller)) {

src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ protected function validate(Request $request, Response $entry, $catch = false)
388388
// We keep the etags from the client to handle the case when the client
389389
// has a different private valid entry which is not cached here.
390390
$cachedEtags = $entry->getEtag() ? array($entry->getEtag()) : array();
391-
$requestEtags = $request->getEtags();
391+
$requestEtags = $request->getETags();
392392
if ($etags = array_unique(array_merge($cachedEtags, $requestEtags))) {
393393
$subRequest->headers->set('if_none_match', implode(', ', $etags));
394394
}

src/Symfony/Component/HttpKernel/Profiler/MemcacheProfilerStorage.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ protected function getMemcache()
4141
$port = $matches[3];
4242

4343
$memcache = new \Memcache();
44-
$memcache->addServer($host, $port);
44+
$memcache->addserver($host, $port);
4545

4646
$this->memcache = $memcache;
4747
}

src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ public function testCollect()
3737

3838
// if else clause because we don't know it
3939
if (extension_loaded('xdebug')) {
40-
$this->assertTrue($c->hasXdebug());
40+
$this->assertTrue($c->hasXDebug());
4141
} else {
42-
$this->assertFalse($c->hasXdebug());
42+
$this->assertFalse($c->hasXDebug());
4343
}
4444

4545
// if else clause because we don't know it

src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ protected function getDateTime($timestamp, $timeZone)
868868
{
869869
$dateTime = new \DateTime();
870870
$dateTime->setTimestamp(null === $timestamp ? time() : $timestamp);
871-
$dateTime->setTimeZone(new \DateTimeZone($timeZone));
871+
$dateTime->setTimezone(new \DateTimeZone($timeZone));
872872

873873
return $dateTime;
874874
}

src/Symfony/Component/Process/Tests/PhpExecutableFinderTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function testFindWithSuffix()
9191
//TODO maybe php executable is custom or even Windows
9292
if ('\\' === DIRECTORY_SEPARATOR) {
9393
$this->assertTrue(is_executable($current));
94-
$this->assertTrue((bool) preg_match('/'.addSlashes(DIRECTORY_SEPARATOR).'php\.(exe|bat|cmd|com)$/i', $current), '::find() returns the executable PHP with suffixes');
94+
$this->assertTrue((bool) preg_match('/'.addslashes(DIRECTORY_SEPARATOR).'php\.(exe|bat|cmd|com)$/i', $current), '::find() returns the executable PHP with suffixes');
9595
}
9696
}
9797
}

src/Symfony/Component/Security/Acl/Domain/ObjectIdentity.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ final class ObjectIdentity implements ObjectIdentityInterface
3636
*/
3737
public function __construct($identifier, $type)
3838
{
39-
if (empty($identifier)) {
39+
if ('' === $identifier) {
4040
throw new \InvalidArgumentException('$identifier cannot be empty.');
4141
}
4242
if (empty($type)) {
@@ -66,7 +66,7 @@ public static function fromDomainObject($domainObject)
6666
if ($domainObject instanceof DomainObjectInterface) {
6767
return new self($domainObject->getObjectIdentifier(), ClassUtils::getRealClass($domainObject));
6868
} elseif (method_exists($domainObject, 'getId')) {
69-
return new self($domainObject->getId(), ClassUtils::getRealClass($domainObject));
69+
return new self((string) $domainObject->getId(), ClassUtils::getRealClass($domainObject));
7070
}
7171
} catch (\InvalidArgumentException $invalid) {
7272
throw new InvalidDomainObjectException($invalid->getMessage(), 0, $invalid);

src/Symfony/Component/Security/Acl/Tests/Domain/EntryTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function testSetAuditSuccess()
3636
$this->assertTrue($ace->isAuditSuccess());
3737
$ace->setAuditSuccess(false);
3838
$this->assertFalse($ace->isAuditSuccess());
39-
$ace->setAuditsuccess(true);
39+
$ace->setAuditSuccess(true);
4040
$this->assertTrue($ace->isAuditSuccess());
4141
}
4242

0 commit comments

Comments
 (0)