10000 Merge branch '2.8' into 3.4 · symfony/symfony@34d5b5e · GitHub
[go: up one dir, main page]

Skip to content

Commit 34d5b5e

Browse files
Merge branch '2.8' into 3.4
* 2.8: (29 commits) [Console] Fix docblock of DescriptorInterface::describe [Config] Handle nullable node name + fix inheritdocs [Security] added userChecker to SimpleAuthenticationProvider [Debug] fix test Fix typo in test method name Fixes #26563 (open_basedir restriction in effect) [Debug] Reset previous exception handler ealier to prevent infinite loop add hint in Github pull request template [Validator] Fix docblock of ClassMetadata#members [BrowserKit] Fix cookie path handling when $domain is null [DoctrineBridge] Don't rely on ClassMetadataInfo->hasField in DoctrineOrmTypeGuesser anymore [BrowserKit] Improves CookieJar::get [BrowserKit] Fix Cookie's PHPDoc [DomCrawler] Change bad wording in ChoiceFormField::untick [DomCrawler] Fix the PHPDoc of ChoiceFormField::setValue [DomCrawler] Avoid a useless call to strtolower [FrameworkBundle] HttpCache is not longer abstract Php Inspections (EA Ultimate): address some of one-time used local variables [Intl] Load locale aliases to support alias fallbacks [CssSelector] Fix CSS identifiers parsing - they can start with dash ...
2 parents ed028fc + 677d9aa commit 34d5b5e

File tree

38 files changed

+333
-160
lines changed

38 files changed

+333
-160
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
| Bug fix? | yes/no
55
| New feature? | yes/no <!-- don't forget to update src/**/CHANGELOG.md files -->
66
| BC breaks? | no <!-- see https://symfony.com/bc -->
7-
| Deprecations? | yes/no <!-- don't forget to update UPGRADE-*.md files -->
7+
| Deprecations? | yes/no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
88
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
99
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
1010
| License | MIT

CONTRIBUTORS.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ Symfony is the result of the work of many people who made the code better
4343
- Diego Saint Esteben (dosten)
4444
- Alexandre Salomé (alexandresalome)
4545
- William Durand (couac)
46+
- Hamza Amrouche (simperfit)
4647
- ornicar
4748
- Francis Besset (francisbesset)
4849
- Iltar van der Berg (kjarli)
4950
- stealth35 ‏ (stealth35)
50-
- Hamza Amrouche (simperfit)
5151
- Alexander Mols (asm89)
5252
- Yonel Ceruto (yonelceruto)
5353
- Bulat Shakirzyanov (avalanche123)
@@ -57,15 +57,16 @@ Symfony is the result of the work of many people who made the code better
5757
- Henrik Bjørnskov (henrikbjorn)
5858
- Miha Vrhovnik
5959
- Diego Saint Esteben (dii3g0)
60-
- Dany Maillard (maidmaid)
6160
- Pierre du Plessis (pierredup)
61+
- Dany Maillard (maidmaid)
6262
- Konstantin Kudryashov (everzet)
6363
- Kevin Bond (kbond)
6464
- Bilal Amarni (bamarni)
6565
- Alexander M. Turek (derrabus)
6666
- Jérémy DERUSSÉ (jderusse)
6767
- Florin Patan (florinpatan)
6868
- Samuel ROZE (sroze)
69+
- Tobias Nyholm (tobias)
6970
- Gábor Egyed (1ed)
7071
- Michel Weimerskirch (mweimerskirch)
7172
- Andrej Hudec (pulzarraider)
@@ -75,7 +76,6 @@ Symfony is the result of the work of many people who made the code better
7576
- Titouan Galopin (tgalopin)
7677
- Konstantin Myakshin (koc)
7778
- Christian Raue
78-
- Tobias Nyholm (tobias)
7979
- Arnout Boks (aboks)
8080
- Deni
8181
- Henrik Westphal (snc)
@@ -200,6 +200,7 @@ Symfony is the result of the work of many people who made the code better
200200
- Matthieu Bontemps (mbontemps)
201201
- apetitpa
202202
- Pierre Minnieur (pminnieur)
203+
- Jannik Zschiesche (apfelbox)
203204
- fivestar
204205
- Dominique Bongiraud
205206
- Jeremy Livingston (jeremylivingston)
@@ -224,7 +225,6 @@ Symfony is the result of the work of many people who made the code better
224225
- Marcel Beerta (mazen)
225226
- gadelat (gadelat)
226227
- Loïc Faugeron
227-
- Jannik Zschiesche (apfelbox)
228228
- Hidde Wieringa (hiddewie)
229229
- Marco Pivetta (ocramius)
230230
- Rob Frawley 2nd (robfrawley)
@@ -697,6 +697,7 @@ Symfony is the result of the work of many people who made the code better
697697
- Nykopol (nykopol)
698698
- Jordan Deitch
699699
- Casper Valdemar Poulsen
700+
- Remon van de Kamp
700701
- Josiah (josiah)
701702
- Joschi Kuphal
702703
- John Bohn (jbohn)
@@ -736,6 +737,7 @@ Symfony is the result of the work of many people who made the code better
736737
- Adrien Lucas (adrienlucas)
737738
- Zhuravlev Alexander (scif)
738739
- James Michael DuPont
740+
- Xavier HAUSHERR
739741
- Tom Klingenberg
740742
- Christopher Hall (mythmakr)
741743
- Patrick Dawkins (pjcdawkins)
@@ -1102,7 +1104,6 @@ Symfony is the result of the work of many people who made the code better
11021104
- Pierre Tachoire (krichprollsch)
11031105
- Marc J. Schmidt (marcjs)
11041106
- Marco Jantke
1105-
- Remon van de Kamp
11061107
- Saem Ghani
11071108
- Clément LEFEBVRE
11081109
- Conrad Kleinespel
@@ -1225,7 +1226,6 @@ Symfony is the result of the work of many people who made the code better
12251226
- Sebastian Ionescu
12261227
- Thomas Ploch
12271228
- Simon Neidhold
1228-
- Xavier HAUSHERR
12291229
- Valentin VALCIU
12301230
- Jeremiah VALERIE
12311231
- Kevin Dew
@@ -1573,6 +1573,7 @@ Symfony is the result of the work of many people who made the code better
15731573
- Vladimir Chernyshev (volch)
15741574
- Yorkie Chadwick (yorkie76)
15751575
- GuillaumeVerdon
1576+
- Philipp Keck
15761577
- Ondrej Mirtes
15771578
- akimsko
15781579
- Youpie
@@ -1630,6 +1631,7 @@ Symfony is the result of the work of many people who made the code better
16301631
- Jordan Hoff
16311632
- znerol
16321633
- Christian Eikermann
1634+
- Kai Eichinger
16331635
- Antonio Angelino
16341636
- Matt Fields
16351637
- Niklas Keller

src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function guessRequired($class, $property)
9797
$classMetadata = $classMetadatas[0];
9898

9999
// Check whether the field exists and is nullable or not
100-
if ($classMetadata->hasField($property)) {
100+
if (isset($classMetadata->fieldMappings[$property])) {
101101
if (!$classMetadata->isNullable($property) && Type::BOOLEAN !== $classMetadata->getTypeOfField($property)) {
102102
return new ValueGuess(true, Guess::HIGH_CONFIDENCE);
103103
}
@@ -126,7 +126,7 @@ public function guessRequired($class, $property)
126126
public function guessMaxLength($class, $property)
127127
{
128128
$ret = $this->getMetadata($class);
129-
if ($ret && $ret[0]->hasField($property) && !$ret[0]->hasAssociation($property)) {
129+
if ($ret && isset($ret[0]->fieldMappings[$property]) && !$ret[0]->hasAssociation($property)) {
130130
$mapping = $ret[0]->getFieldMapping($property);
131131

132132
if (isset($mapping['length'])) {
@@ -145,7 +145,7 @@ public function guessMaxLength($class, $property)
145145
public function guessPattern($class, $property)
146146
{
147147
$ret = $this->getMetadata($class);
148-
if ($ret && $ret[0]->hasField($property) && !$ret[0]->hasAssociation($property)) {
148+
if ($ret && isset($ret[0]->fieldMappings[$property]) && !$ret[0]->hasAssociation($property)) {
149149
if (in_array($ret[0]->getTypeOfField($property), array(Type::DECIMAL, Type::FLOAT))) {
150150
return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
151151
}

src/Symfony/Bridge/Doctrine/Tests/Form/DoctrineOrmTypeGuesserTest.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,20 @@ public function requiredProvider()
3333

3434
// Simple field, not nullable
3535
$classMetadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock();
36-
$classMetadata->expects($this->once())->method('hasField')->with('field')->will($this->returnValue(true));
36+
$classMetadata->fieldMappings['field'] = true;
3737
$classMetadata->expects($this->once())->method('isNullable')->with('field')->will($this->returnValue(false));
3838

3939
$return[] = array($classMetadata, new ValueGuess(true, Guess::HIGH_CONFIDENCE));
4040

4141
// Simple field, nullable
4242
$classMetadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock();
43-
$classMetadata->expects($this->once())->method('hasField')->with('field')->will($this->returnValue(true));
43+
$classMetadata->fieldMappings['field'] = true;
4444
$classMetadata->expects($this->once())->method('isNullable')->with('field')->will($this->returnValue(true));
4545

4646
$return[] = array($classMetadata, new ValueGuess(false, Guess::MEDIUM_CONFIDENCE));
4747

4848
// One-to-one, nullable (by default)
4949
$classMetadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock();
50-
$classMetadata->expects($this->once())->method('hasField')->with('field')->will($this->returnValue(false));
5150
$classMetadata->expects($this->once())->method('isAssociationWithSingleJoinColumn')->with('field')->will($this->returnValue(true));
5251

5352
$mapping = array('joinColumns' => array(array()));
@@ -57,7 +56,6 @@ public function requiredProvider()
5756

5857
// One-to-one, nullable (explicit)
5958
$classMetadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock();
60-
$classMetadata->expects($this->once())->method('hasField')->with('field')->will($this->returnValue(false));
6159
$classMetadata->expects($this->once())->method('isAssociationWithSingleJoinColumn')->with('field')->will($this->returnValue(true));
6260

6361
$mapping = array('joinColumns' => array(array('nullable' => true)));
@@ -67,7 +65,6 @@ public function requiredProvider()
6765

6866
// One-to-one, not nullable
6967
$classMetadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock();
70-
$classMetadata->expects($this->once())->method('hasField')->with('field')->will($this->returnValue(false));
7168
$classMetadata->expects($this->once())->method('isAssociationWithSingleJoinColumn')->with('field')->will($this->returnValue(true));
7269

7370
$mapping = array('joinColumns' => array(array('nullable' => false)));
@@ -77,7 +74,6 @@ public function requiredProvider()
7774

7875
// One-to-many, no clue
7976
$classMetadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock();
80-
$classMetadata->expects($this->once())->method('hasField')->with('field')->will($this->returnValue(false));
8177
$classMetadata->expects($this->once())->method('isAssociationWithSingleJoinColumn')->with('field')->will($this->returnValue(false));
8278

8379
$return[] = array($classMetadata, null);

src/Symfony/Bridge/Twig/Translation/TwigExtractor.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ public function __construct(Environment $twig)
5454
*/
5555
public function extract($resource, MessageCatalogue $catalogue)
5656
{
57-
$files = $this->extractFiles($resource);
58-
foreach ($files as $file) {
57+
foreach ($this->extractFiles($resource) as $file) {
5958
try {
6059
$this->extractTemplate(file_get_contents($file->getPathname()), $catalogue);
6160
} catch (Error $e) {

src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\HttpCache;
1313

14-
use Symfony\Component\HttpKernel\HttpKernelInterface;
14+
use Symfony\Component\HttpKernel\KernelInterface;
1515
use Symfony\Component\HttpKernel\HttpCache\HttpCache as BaseHttpCache;
1616
use Symfony\Component\HttpKernel\HttpCache\Esi;
1717
use Symfony\Component\HttpKernel\HttpCache\Store;
@@ -23,16 +23,16 @@
2323
*
2424
* @author Fabien Potencier <fabien@symfony.com>
2525
*/
26-
abstract class HttpCache extends BaseHttpCache
26+
class HttpCache extends BaseHttpCache
2727
{
2828
protected $cacheDir;
2929
protected $kernel;
3030

3131
/**
32-
* @param HttpKernelInterface $kernel An HttpKernelInterface instance
33-
* @param string $cacheDir The cache directory (default used if null)
32+
* @param KernelInterface $kernel A KernelInterface instance
33+
* @param string $cacheDir The cache directory (default used if null)
3434
*/
35-
public function __construct(HttpKernelInterface $kernel, $cacheDir = null)
35+
public function __construct(KernelInterface $kernel, $cacheDir = null)
3636
{
3737
$this->kernel = $kernel;
3838
$this->cacheDir = $cacheDir;

src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/SimpleFormFactory.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ protected function createAuthProvider(ContainerBuilder $container, $id, $config,
5555
->replaceArgument(0, new Reference($config['authenticator']))
5656
->replaceArgument(1, new Reference($userProviderId))
5757
->replaceArgument(2, $id)
58+
->replaceArgument(3, new Reference('security.user_checker.'.$id))
5859
;
5960

6061
return $provider;

src/Symfony/Component/BrowserKit/Cookie.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ class Cookie
4444
/**
4545
* Sets a cookie.
4646
*
47-
* @param string $name The cookie name
48-
* @param string $value The value of the cookie
49-
* @param string $expires The time the cookie expires
50-
* @param string $path The path on the server in which the cookie will be available on
51-
* @param string $domain The domain that the cookie is available
52-
* @param bool $secure Indicates that the cookie should only be transmitted over a secure HTTPS connection from the client
53-
* @param bool $httponly The cookie httponly flag
54-
* @param bool $encodedValue Whether the value is encoded or not
47+
* @param string $name The cookie name
48+
* @param string $value The value of the cookie
49+
* @param string|null $expires The time the cookie expires
50+
* @param string|null $path The path on the server in which the cookie will be available on
51+
* @param string $domain The domain that the cookie is available
52+
* @param bool $secure Indicates that the cookie should only be transmitted over a secure HTTPS connection from the client
53+
* @param bool $httponly The cookie httponly flag
54+
* @param bool $encodedValue Whether the value is encoded or not
5555
*/
5656
public function __construct($name, $value, $expires = null, $path = null, $domain = '', $secure = false, $httponly = true, $encodedValue = false)
5757
{
@@ -112,8 +112,8 @@ public function __toString()
112112
/**
113113
* Creates a Cookie instance from a Set-Cookie header value.
114114
*
115-
* @param string $cookie A Set-Cookie header value
116-
* @param string $url The base URL
115+
* @param string $cookie A Set-Cookie header value
116+
* @param string|null $url The base URL
117117
*
118118
* @return static
119119
*
@@ -242,7 +242,7 @@ public function getRawValue()
242242
/**
243243
* Gets the expires time of the cookie.
244244
*
245-
* @return string The cookie expires time
245+
* @return string|null The cookie expires time
246246
*/
247247
public function getExpiresTime()
248248
{

src/Symfony/Component/BrowserKit/CookieJar.php

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -43,32 +43,21 @@ public function get($name, $path = '/', $domain = null)
4343
{
4444
$this->flushExpiredCookies();
4545

46-
if (!empty($domain)) {
47-
foreach ($this->cookieJar as $cookieDomain => $pathCookies) {
48-
if ($cookieDomain) {
49-
$cookieDomain = '.'.ltrim($cookieDomain, '.');
50-
if ($cookieDomain != substr('.'.$domain, -strlen($cookieDomain))) {
51-
continue;
52-
}
53-
}
54-
55-
foreach ($pathCookies as $cookiePath => $namedCookies) {
56-
if ($cookiePath != substr($path, 0, strlen($cookiePath))) {
57-
continue;
58-
}
59-
if (isset($namedCookies[$name])) {
60-
return $namedCookies[$name];
61-
}
46+
foreach ($this->cookieJar as $cookieDomain => $pathCookies) {
47+
if ($cookieDomain && $domain) {
48+
$cookieDomain = '.'.ltrim($cookieDomain, '.');
49+
if ($cookieDomain !== substr('.'.$domain, -\strlen($cookieDomain))) {
50+
continue;
6251
}
6352
}
6453

65-
return;
66-
}
67-
68-
// avoid relying on this behavior that is mainly here for BC reasons
69-
foreach ($this->cookieJar as $cookies) {
70-
if (isset($cookies[$pat F438 h][$name])) {
71-
return $cookies[$path][$name];
54+
foreach ($pathCookies as $cookiePath => $namedCookies) {
55+
if (0 !== strpos($path, $cookiePath)) {
56+
continue;
57+
}
58+
if (isset($namedCookies[$name])) {
59+
return $namedCookies[$name];
60+
}
7261
}
7362
}
7463
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,8 @@ public function testCookieGetWithSubdirectory()
237237
$this->assertEquals($cookie1, $cookieJar->get('foo', '/test', 'example.com'));
238238
$this->assertEquals($cookie2, $cookieJar->get('foo1', '/', 'example.com'));
239239
$this->assertEquals($cookie2, $cookieJar->get('foo1', '/bar', 'example.com'));
240+
241+
$this->assertEquals($cookie2, $cookieJar->get('foo1', '/bar'));
240242
}
241243

242244
public function testCookieWithWildcardDomain()

src/Symfony/Component/Config/Definition/ArrayNode.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -153,31 +153,23 @@ public function setIgnoreExtraKeys($boolean, $remove = true)
153153
}
154154

155155
/**
156-
* Sets the node Name.
157-
*
158-
* @param string $name The node's name
156+
* {@inheritdoc}
159157
*/
160158
public function setName($name)
161159
{
162160
$this->name = $name;
163161
}
164162

165163
/**
166-
* Checks if the node has a default value.
167-
*
168-
* @return bool
164+
* {@inheritdoc}
169165
*/
170166
public function hasDefaultValue()
171167
{
172168
return $this->addIfNotSet;
173169
}
174170

175171
/**
176-
* Retrieves the default value.
177-
*
178-
* @return array The default value
179-
*
180-
* @throws \RuntimeException if the node has no default value
172+
* {@inheritdoc}
181173
*/
182174
public function getDefaultValue()
183175
{

0 commit comments

Comments
 (0)
0