Skip to content

Commit 824dc8b

Browse files
committed
Merge branch '2.8' into 3.2
* 2.8: Fix minor phpdoc mismatches with the code(detected by phan) [Asset] Starting slash should indicate no basePath wanted [Security] Fix phpdoc logout listener Add iconv extension to suggested dependencies Fix minor typo in the main README.md Allow Upper Case property names in ObjectNormalizer [EventDispatcher] fix: unwrap listeners for correct info
2 parents c590e85 + 6000faf commit 824dc8b

File tree

29 files changed

+145
-88
lines changed

29 files changed

+145
-88
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ If you discover a security vulnerability within Symfony, please follow our
4646
About Us
4747
--------
4848

49-
Symfony development is sponsored by [SensioLabs][21], lead by the
49+
Symfony development is sponsored by [SensioLabs][21], led by the
5050
[Symfony Core Team][22] and supported by [Symfony contributors][19].
5151

5252
[1]: https://symfony.com

src/Symfony/Component/Asset/PathPackage.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ public function getUrl($path)
5959

6060
$versionedPath = $this->getVersionStrategy()->applyVersion($path);
6161

62-
if ($this->isAbsoluteUrl($versionedPath)) {
62+
// if absolute or begins with /, we're done
63+
if ($this->isAbsoluteUrl($versionedPath) || ($versionedPath && '/' === $versionedPath[0])) {
6364
return $versionedPath;
6465
}
6566

src/Symfony/Component/Asset/Tests/PathPackageTest.php

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@ public function getConfigs()
3535

3636
array('', '', '/foo', '/foo?v1'),
3737

38-
array('/foo', '', '/foo', '/foo/foo?v1'),
39-
array('/foo', '', 'foo', '/foo/foo?v1'),
40-
array('foo', '', 'foo', '/foo/foo?v1'),
41-
array('foo/', '', 'foo', '/foo/foo?v1'),
42-
array('/foo/', '', 'foo', '/foo/foo?v1'),
43-
44-
array('/foo', 'version-%2$s/%1$s', '/foo', '/foo/version-v1/foo'),
45-
array('/foo', 'version-%2$s/%1$s', 'foo', '/foo/version-v1/foo'),
46-
array('/foo', 'version-%2$s/%1$s', 'foo/', '/foo/version-v1/foo/'),
47-
array('/foo', 'version-%2$s/%1$s', '/foo/', '/foo/version-v1/foo/'),
38+
array('/foo', '', '/bar', '/bar?v1'),
39+
array('/foo', '', 'bar', '/foo/bar?v1'),
40+
array('foo', '', 'bar', '/foo/bar?v1'),
41+
array('foo/', '', 'bar', '/foo/bar?v1'),
42+
array('/foo/', '', 'bar', '/foo/bar?v1'),
43+
44+
array('/foo', 'version-%2$s/%1$s', '/bar', '/version-v1/bar'),
45+
array('/foo', 'version-%2$s/%1$s', 'bar', '/foo/version-v1/bar'),
46+
array('/foo', 'version-%2$s/%1$s', 'bar/', '/foo/version-v1/bar/'),
47+
array('/foo', 'version-%2$s/%1$s', '/bar/', '/version-v1/bar/'),
4848
);
4949
}
5050

@@ -61,17 +61,17 @@ public function testGetUrlWithContext($basePathRequest, $basePath, $format, $pat
6161
public function getContextConfigs()
6262
{
6363
return array(
64-
array('', '/foo', '', '/foo', '/foo/foo?v1'),
65-
array('', '/foo', '', 'foo', '/foo/foo?v1'),
66-
array('', 'foo', '', 'foo', '/foo/foo?v1'),
67-
array('', 'foo/', '', 'foo', '/foo/foo?v1'),
68-
array('', '/foo/', '', 'foo', '/foo/foo?v1'),
69-
70-
array('/bar', '/foo', '', '/foo', '/bar/foo/foo?v1'),
71-
array('/bar', '/foo', '', 'foo', '/bar/foo/foo?v1'),
72-
array('/bar', 'foo', '', 'foo', '/bar/foo/foo?v1'),
73-
array('/bar', 'foo/', '', 'foo', '/bar/foo/foo?v1'),
74-
array('/bar', '/foo/', '', 'foo', '/bar/foo/foo?v1'),
64+
array('', '/foo', '', '/baz', '/baz?v1'),
65+
array('', '/foo', '', 'baz', '/foo/baz?v1'),
66+
array('', 'foo', '', 'baz', '/foo/baz?v1'),
67+
array('', 'foo/', '', 'baz', '/foo/baz?v1'),
68+
array('', '/foo/', '', 'baz', '/foo/baz?v1'),
69+
70+
array('/bar', '/foo', '', '/baz', '/baz?v1'),
71+
array('/bar', '/foo', '', 'baz', '/bar/foo/baz?v1'),
72+
array('/bar', 'foo', '', 'baz', '/bar/foo/baz?v1'),
73+
array('/bar', 'foo/', '', 'baz', '/bar/foo/baz?v1'),
74+
array('/bar', '/foo/', '', 'baz', '/bar/foo/baz?v1'),
7575
);
7676
}
7777

src/Symfony/Component/CssSelector/Parser/Reader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function getOffset($string)
9797
/**
9898
* @param string $pattern
9999
*
100-
* @return bool
100+
* @return array|false
101101
*/
102102
public function findPattern($pattern)
103103
{

src/Symfony/Component/CssSelector/XPath/Extension/NodeExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function setFlag($flag, $on)
7272
*/
7373
public function hasFlag($flag)
7474
{
75-
return $this->flags & $flag;
75+
return (bool) ($this->flags & $flag);
7676
}
7777

7878
/**

src/Symfony/Component/EventDispatcher/Tests/Debug/TraceableEventDispatcherTest.php

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

1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher;
16+
use Symfony\Component\EventDispatcher\Debug\WrappedListener;
1617
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
1718
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
1819
use Symfony\Component\EventDispatcher\EventDispatcher;
@@ -104,27 +105,44 @@ public function testAddRemoveSubscriber()
104105
$this->assertCount(0, $dispatcher->getListeners('foo'));
105106
}
106107

107-
public function testGetCalledListeners()
108+
/**
109+
* @dataProvider isWrappedDataProvider
110+
*
111+
* @param bool $isWrapped
112+
*/
113+
public function testGetCalledListeners($isWrapped)
108114
{
109115
$dispatcher = new EventDispatcher();
110-
$tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch());
111-
$tdispatcher->addListener('foo', $listener = function () {});
116+
$stopWatch = new Stopwatch();
117+
$tdispatcher = new TraceableEventDispatcher($dispatcher, $stopWatch);
118+
119+
$listener = function () {};
120+
if ($isWrapped) {
121+
$listener = new WrappedListener($listener, 'foo', $stopWatch, $dispatcher);
122+
}
123+
124+
$tdispatcher->addListener('foo', $listener, 5);
112125

113126
$listeners = $tdispatcher->getNotCalledListeners();
114127
$this->assertArrayHasKey('data', $listeners['foo.closure']);
115128
unset($listeners['foo.closure']['data']);
116129
$this->assertEquals(array(), $tdispatcher->getCalledListeners());
117-
$this->assertEquals(array('foo.closure' => array('event' => 'foo', 'pretty' => 'closure', 'priority' => 0)), $listeners);
130+
$this->assertEquals(array('foo.closure' => array('event' => 'foo', 'type' => 'Closure', 'pretty' => 'closure', 'priority' => 5)), $tdispatcher->getNotCalledListeners());
118131

119132
$tdispatcher->dispatch('foo');
120133

121-
$listeners = $tdispatcher->getCalledListeners();
122-
$this->assertArrayHasKey('data', $listeners['foo.closure']);
123-
unset($listeners['foo.closure']['data']);
124-
$this->assertEquals(array('foo.closure' => array('event' => 'foo', 'pretty' => 'closure', 'priority' => 0)), $listeners);
134+
$this->assertEquals(array('foo.closure' => array('event' => 'foo', 'type' => 'Closure', 'pretty' => 'closure', 'priority' => 5)), $tdispatcher->getCalledListeners());
125135
$this->assertEquals(array(), $tdispatcher->getNotCalledListeners());
126136
}
127137

138+
public function isWrappedDataProvider()
139+
{
140+
return array(
141+
array(false),
142+
array(true),
143+
);
144+
}
145+
128146
public function testGetCalledListenersNested()
129147
{
130148
$tdispatcher = null;

src/Symfony/Component/ExpressionLanguage/Lexer.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function tokenize($expression)
4242
continue;
4343
}
4444

45-
if (preg_match('/[0-9]+(?:\.[0-9]+)?/A', $expression, $match, null, $cursor)) {
45+
if (preg_match('/[0-9]+(?:\.[0-9]+)?/A', $expression, $match, 0, $cursor)) {
4646
// numbers
4747
$number = (float) $match[0]; // floats
4848
if (preg_match('/^[0-9]+$/', $match[0]) && $number <= PHP_INT_MAX) {
@@ -69,19 +69,19 @@ public function tokenize($expression)
6969

7070
$tokens[] = new Token(Token::PUNCTUATION_TYPE, $expression[$cursor], $cursor + 1);
7171
++$cursor;
72-
} elseif (preg_match('/"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'/As', $expression, $match, null, $cursor)) {
72+
} elseif (preg_match('/"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'/As', $expression, $match, 0, $cursor)) {
7373
// strings
7474
$tokens[] = new Token(Token::STRING_TYPE, stripcslashes(substr($match[0], 1, -1)), $cursor + 1);
7575
$cursor += strlen($match[0]);
76-
} elseif (preg_match('/not in(?=[\s(])|\!\=\=|not(?=[\s(])|and(?=[\s(])|\=\=\=|\>\=|or(?=[\s(])|\<\=|\*\*|\.\.|in(?=[\s(])|&&|\|\||matches|\=\=|\!\=|\*|~|%|\/|\>|\||\!|\^|&|\+|\<|\-/A', $expression, $match, null, $cursor)) {
76+
} elseif (preg_match('/not in(?=[\s(])|\!\=\=|not(?=[\s(])|and(?=[\s(])|\=\=\=|\>\=|or(?=[\s(])|\<\=|\*\*|\.\.|in(?=[\s(])|&&|\|\||matches|\=\=|\!\=|\*|~|%|\/|\>|\||\!|\^|&|\+|\<|\-/A', $expression, $match, 0, $cursor)) {
7777
// operators
7878
$tokens[] = new Token(Token::OPERATOR_TYPE, $match[0], $cursor + 1);
7979
$cursor += strlen($match[0]);
8080
} elseif (false !== strpos('.,?:', $expression[$cursor])) {
8181
// punctuation
8282
$tokens[] = new Token(Token::PUNCTUATION_TYPE, $expression[$cursor], $cursor + 1);
8383
++$cursor;
84-
} elseif (preg_match('/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/A', $expression, $match, null, $cursor)) {
84+
} elseif (preg_match('/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/A', $expression, $match, 0, $cursor)) {
8585
// names
8686
$tokens[] = new Token(Token::NAME_TYPE, $match[0], $cursor + 1);
8787
$cursor += strlen($match[0]);

src/Symfony/Component/ExpressionLanguage/Token.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Token
3232
/**
3333
* Constructor.
3434
*
35-
* @param int $type The type of the token
35+
* @param string $type The type of the token (self::*_TYPE)
3636
* @param string $value The token value
3737
* @param int $cursor The cursor position in the source
3838
*/

src/Symfony/Component/HttpFoundation/FileBag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function add(array $files = array())
6969
*
7070
* @param array|UploadedFile $file A (multi-dimensional) array of uploaded file information
7171
*
72-
* @return array A (multi-dimensional) array of UploadedFile instances
72+
* @return UploadedFile|UploadedFile[] A (multi-dimensional) array of UploadedFile instances
7373
*/
7474
protected function convertFileInformation($file)
7575
{

src/Symfony/Component/HttpFoundation/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ public function getScheme()
930930
* If your reverse proxy uses a different header name than "X-Forwarded-Port",
931931
* configure it via "setTrustedHeaderName()" with the "client-port" key.
932932
*
933-
* @return string
933+
* @return int|string can be a string if fetched from the server bag
934934
*/
935935
public function getPort()
936936
{

0 commit comments

Comments
 (0)