Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 895b123

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: bumped Symfony version to 2.7.30 Cache ipCheck updated VERSION for 2.7.29 update CONTRIBUTORS for 2.7.29 updated CHANGELOG for 2.7.29 show unique inherited roles
2 parents e8497bb + 589f2b1 commit 895b123

File tree

5 files changed

+46
-18
lines changed

5 files changed

+46
-18
lines changed

CHANGELOG-2.7.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ in 2.7 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.7.0...v2.7.1
99

10+
* 2.7.29 (2017-06-07)
11+
12+
* bug #23069 [SecurityBundle] Show unique Inherited roles in profile panel (yceruto)
13+
* bug #23073 [TwigBridge] Fix namespaced classes (ogizanagi)
14+
* bug #22936 [Form] Mix attr option between guessed options and user options (yceruto)
15+
* bug #23024 [EventDispatcher] Fix ContainerAwareEventDispatcher::hasListeners(null) (nicolas-grekas)
16+
* bug #22996 [Form] Fix \IntlDateFormatter timezone parameter usage to bypass PHP bug #66323 (romainneutron)
17+
* bug #22994 Harden the debugging of Twig filters and functions (stof)
18+
1019
* 2.7.28 (2017-05-29)
1120

1221
* bug #22847 [Console] ChoiceQuestion must have choices (ro0NL)

CONTRIBUTORS.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ Symfony is the result of the work of many people who made the code better
2020
- Javier Eguiluz (javier.eguiluz)
2121
- Hugo Hamon (hhamon)
2222
- Abdellatif Ait boudad (aitboudad)
23+
- Romain Neutron (romain)
2324
- Pascal Borreli (pborreli)
2425
- Wouter De Jong (wouterj)
25-
- Romain Neutron (romain)
26-
- Grégoire Pineau (lyrixx)
2726
- Robin Chalas (chalas_r)
28-
- Joseph Bielawski (stloyd)
2927
- Maxime Steinhausser (ogizanagi)
28+
- Grégoire Pineau (lyrixx)
29+
- Joseph Bielawski (stloyd)
3030
- Karma Dordrak (drak)
3131
- Lukas Kahwe Smith (lsmith)
3232
- Martin Hasoň (hason)
@@ -72,8 +72,8 @@ Symfony is the result of the work of many people who made the code better
7272
- Dariusz Górecki (canni)
7373
- Titouan Galopin (tgalopin)
7474
- Douglas Greenshields (shieldo)
75-
- Konstantin Myakshin (koc)
7675
- Jáchym Toušek (enumag)
76+
- Konstantin Myakshin (koc)
7777
- Lee McDermott
7878
- Brandon Turner
7979
- Luis Cordova (cordoval)
@@ -112,10 +112,10 @@ Symfony is the result of the work of many people who made the code better
112112
- Jacob Dreesen (jdreesen)
113113
- Tobias Nyholm (tobias)
114114
- Tomáš Votruba (tomas_votruba)
115+
- Yonel Ceruto González (yonelceruto)
115116
- Fabien Pennequin (fabienpennequin)
116117
- Gordon Franke (gimler)
117118
- Eric GELOEN (gelo)
118-
- Yonel Ceruto González (yonelceruto)
119119
- Daniel Wehner (dawehner)
120120
- Tugdual Saunier (tucksaun)
121121
- Théo FIDRY (theofidry)
@@ -130,6 +130,7 @@ Symfony is the result of the work of many people who made the code better
130130
- Daniel Gomes (danielcsgomes)
131131
- Hidenori Goto (hidenorigoto)
132132
- Guilherme Blanco (guilhermeblanco)
133+
- Vincent AUBERT (vincent)
133134
- Pablo Godel (pgodel)
134135
- Jérémie Augustin (jaugustin)
135136
- Andréia Bohner (andreia)
@@ -140,18 +141,17 @@ Symfony is the result of the work of many people who made the code better
140141
- Joel Wurtz (brouznouf)
141142
- Philipp Wahala (hifi)
142143
- Vyacheslav Pavlov
144+
- Richard van Laak (rvanlaak)
143145
- Javier Spagnoletti (phansys)
144146
- Richard Shank (iampersistent)
145147
- Thomas Rabaix (rande)
146-
- Vincent AUBERT (vincent)
147148
- Rouven Weßling (realityking)
148149
- Teoh Han Hui (teohhanhui)
149150
- Jérôme Vasseur (jvasseur)
150151
- Clemens Tolboom
151152
- Helmer Aaviksoo
152153
- Grégoire Paris (greg0ire)
153154
- Hiromi Hishida (77web)
154-
- Richard van Laak (rvanlaak)
155155
- Matthieu Ouellette-Vachon (maoueh)
156156
- Michał Pipa (michal.pipa)
157157
- Amal Raghav (kertz)
@@ -242,6 +242,7 @@ Symfony is the result of the work of many people who made the code better
242242
- Uwe Jäger (uwej711)
243243
- Eugene Leonovich (rybakit)
244244
- Filippo Tessarotto
245+
- Oleg Voronkovich
245246
- Joseph Rouff (rouffj)
246247
- Félix Labrecque (woodspire)
247248
- GordonsLondon
@@ -277,7 +278,6 @@ Symfony is the result of the work of many people who made the code better
277278
- Jordan Samouh (jordansamouh)
278279
- Chris Smith (cs278)
279280
- Florian Klein (docteurklein)
280-
- Oleg Voronkovich
281281
- Manuel Kiessling (manuelkiessling)
282282
- Atsuhiro KUBO (iteman)
283283
- Andrew Moore (finewolf)
@@ -387,6 +387,7 @@ Symfony is the result of the work of many people who made the code better
387387
- Emanuele Gaspari (inmarelibero)
388388
- Sébastien Santoro (dereckson)
389389
- Brian King
390+
- Frank de Jonge (frenkynet)
390391
- Michel Salib (michelsalib)
391392
- geoffrey
392393
- Steffen Roßkamp
@@ -523,7 +524,6 @@ Symfony is the result of the work of many people who made the code better
523524
- Romain Pierre (romain-pierre)
524525
- Jan Behrens
525526
- Mantas Var (mvar)
526-
- Frank de Jonge (frenkynet)
527527
- Sebastian Krebs
528528
- Jean-Christophe Cuvelier [Artack]
529529
- Christopher Davis (chrisguitarguy)
@@ -1278,6 +1278,7 @@ Symfony is the result of the work of many people who made the code better
12781278
- ged15
12791279
- Daan van Renterghem
12801280
- Nicole Cordes
1281+
- Martin Kirilov
12811282
- Bram Van der Sype (brammm)
12821283
- Christopher Hertel (chertel)
12831284
- Guile (guile)

src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function collect(Request $request, Response $response, \Exception $except
100100
'logout_url' => $logoutUrl,
101101
'user' => $token->getUsername(),
102102
'roles' => array_map(function (RoleInterface $role) { return $role->getRole(); }, $assignedRoles),
103-
'inherited_roles' => array_map(function (RoleInterface $role) { return $role->getRole(); }, $inheritedRoles),
103+
'inherited_roles' => array_unique(array_map(function (RoleInterface $role) { return $role->getRole(); }, $inheritedRoles)),
104104
'supports_role_hierarchy' => null !== $this->roleHierarchy,
105105
);
106106
}

src/Symfony/Bundle/SecurityBundle/Tests/DataCollector/SecurityDataCollectorTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,19 @@ public function provideRoles()
111111
array('ROLE_ADMIN'),
112112
array('ROLE_USER', 'ROLE_ALLOWED_TO_SWITCH'),
113113
),
114+
array(
115+
array('ROLE_ADMIN', 'ROLE_OPERATOR'),
116+
array('ROLE_ADMIN', 'ROLE_OPERATOR'),
117+
array('ROLE_USER', 'ROLE_ALLOWED_TO_SWITCH'),
118+
),
114119
);
115120
}
116121

117122
private function getRoleHierarchy()
118123
{
119124
return new RoleHierarchy(array(
120125
'ROLE_ADMIN' => array('ROLE_USER', 'ROLE_ALLOWED_TO_SWITCH'),
126+
'ROLE_OPERATOR' => array('ROLE_USER'),
121127
));
122128
}
123129

src/Symfony/Component/HttpFoundation/IpUtils.php

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
*/
1919
class IpUtils
2020
{
21+
private static $checkedIps = array();
22+
2123
/**
2224
* This class should not be instantiated.
2325
*/
@@ -61,26 +63,31 @@ public static function checkIp($requestIp, $ips)
6163
*/
6264
public static function checkIp4($requestIp, $ip)
6365
{
66+
$cacheKey = $requestIp.'-'.$ip;
67+
if (isset(self::$checkedIps[$cacheKey])) {
68+
return self::$checkedIps[$cacheKey];
69+
}
70+
6471
if (!filter_var($requestIp, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
65-
return false;
72+
return self::$checkedIps[$cacheKey] = false;
6673
}
6774

6875
if (false !== strpos($ip, '/')) {
6976
list($address, $netmask) = explode('/', $ip, 2);
7077

7178
if ($netmask === '0') {
72-
return filter_var($address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
79+
return self::$checkedIps[$cacheKey] = filter_var($address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
7380
}
7481

7582
if ($netmask < 0 || $netmask > 32) {
76-
return false;
83+
return self::$checkedIps[$cacheKey] = false;
7784
}
7885
} else {
7986
$address = $ip;
8087
$netmask = 32;
8188
}
8289

83-
return 0 === substr_compare(sprintf('%032b', ip2long($requestIp)), sprintf('%032b', ip2long($address)), 0, $netmask);
90+
return self::$checkedIps[$cacheKey] = 0 === substr_compare(sprintf('%032b', ip2long($requestIp)), sprintf('%032b', ip2long($address)), 0, $netmask);
8491
}
8592

8693
/**
@@ -100,6 +107,11 @@ public static function checkIp4($requestIp, $ip)
100107
*/
101108
public static function checkIp6($requestIp, $ip)
102109
{
110+
$cacheKey = $requestIp.'-'.$ip;
111+
if (isset(self::$checkedIps[$cacheKey])) {
112+
return self::$checkedIps[$cacheKey];
113+
}
114+
103115
if (!((extension_loaded('sockets') && defined('AF_INET6')) || @inet_pton('::1'))) {
104116
throw new \RuntimeException('Unable to check Ipv6. Check that PHP was not compiled with option "disable-ipv6".');
105117
}
@@ -108,7 +120,7 @@ public static function checkIp6($requestIp, $ip)
108120
list($address, $netmask) = explode('/', $ip, 2);
109121

110122
if ($netmask < 1 || $netmask > 128) {
111-
return false;
123+
return self::$checkedIps[$cacheKey] = false;
112124
}
113125
} else {
114126
$address = $ip;
@@ -119,18 +131,18 @@ public static function checkIp6($requestIp, $ip)
119131
$bytesTest = unpack('n*', @inet_pton($requestIp));
120132

121133
if (!$bytesAddr || !$bytesTest) {
122-
return false;
134+
return self::$checkedIps[$cacheKey] = false;
123135
}
124136

125137
for ($i = 1, $ceil = ceil($netmask / 16); $i <= $ceil; ++$i) {
126138
$left = $netmask - 16 * ($i - 1);
127139
$left = ($left <= 16) ? $left : 16;
128140
$mask = ~(0xffff >> $left) & 0xffff;
129141
if (($bytesAddr[$i] & $mask) != ($bytesTest[$i] & $mask)) {
130-
return false;
142+
return self::$checkedIps[$cacheKey] = false;
131143
}
132144
}
133145

134-
return true;
146+
return self::$checkedIps[$cacheKey] = true;
135147
}
136148
}

0 commit comments

Comments
 (0)