Skip to content

Commit f521c11

Browse files
committed
Merge branch '2.8' into 3.0
* 2.8: fixed undefined variable Fixed the phpDoc of UserInterface fixed APCu dep version make apc class loader testable against apcu without apc bc layer Added support for the `0.0.0.0/0` trusted proxy fixed CS [DoctrineBridge][Validator] >= 2.3 Pass association instead of ID as argument Limit the max height/width of icons in the profiler menu added missing constant Added 451 status code Remove unnecessary code Allow absolute URLs to be displayed in the debug toolbar [ClassLoader] Use symfony/polyfill-apcu update upgrade files with CSRF related option info [TranslationUpdateCommand] fixed undefined resultMessage var. [HttpKernel] Lookup the response even if the lock was released after 2 seconds
2 parents 8ccdd51 + fe14e38 commit f521c11

File tree

17 files changed

+48
-52
lines changed

17 files changed

+48
-52
lines changed

UPGRADE-3.0.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,6 +1103,16 @@ UPGRADE FROM 2.x to 3.0
11031103
* The `supportsAttribute()` and `supportsClass()` methods of classes `AuthenticatedVoter`, `ExpressionVoter`
11041104
and `RoleVoter` have been removed.
11051105

1106+
* The `intention` option was renamed to `csrf_token_id` for all the authentication listeners.
1107+
1108+
* The `csrf_provider` option was renamed to `csrf_token_generator` for all the authentication listeners.
1109+
1110+
### SecurityBundle
1111+
1112+
* The `intention` firewall listener setting was renamed to `csrf_token_id`.
1113+
1114+
* The `csrf_provider` firewall listener setting was renamed to `csrf_token_generator`.
1115+
11061116
### Serializer
11071117

11081118
* The `setCamelizedAttributes()` method of the

src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Doctrine\Common\Persistence\ObjectManager;
1717
use Doctrine\Common\Persistence\ObjectRepository;
1818
use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper;
19-
use Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeIntIdEntity;
2019
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity;
2120
use Symfony\Bridge\Doctrine\Tests\Fixtures\DoubleNameEntity;
2221
use Symfony\Bridge\Doctrine\Tests\Fixtures\AssociationEntity;
@@ -398,7 +397,7 @@ public function testAssociatedEntity()
398397

399398
$this->buildViolation('myMessage')
400399
->atPath('property.path.single')
401-
->setInvalidValue(1)
400+
->setInvalidValue($entity1)
402401
->assertRaised();
403402
}
404403

@@ -422,29 +421,6 @@ public function testAssociatedEntityWithNull()
422421
$this->assertNoViolation();
423422
}
424423

425-
/**
426-
* @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
427-
* @expectedExceptionMessage Associated entities are not allowed to have more than one identifier field
428-
*/
429-
public function testAssociatedCompositeEntity()
430-
{
431-
$constraint = new UniqueEntity(array(
432-
'message' => 'myMessage',
433-
'fields' => array('composite'),
434-
'em' => self::EM_NAME,
435-
));
436-
437-
$composite = new CompositeIntIdEntity(1, 1, 'test');
438-
$associated = new AssociationEntity();
439-
$associated->composite = $composite;
440-
441-
$this->em->persist($composite);
442-
$this->em->persist($associated);
443-
$this->em->flush();
444-
445-
$this->validator->validate($associated, $constraint);
446-
}
447-
448424
/**
449425
* @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
450426
* @expectedExceptionMessage Object manager "foo" does not exist.

src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,6 @@ public function validate($entity, Constraint $constraint)
9696
* getter methods in the Proxy are being bypassed.
9797
*/
9898
$em->initializeObject($criteria[$fieldName]);
99-
100-
$relatedClass = $em->getClassMetadata($class->getAssociationTargetClass($fieldName));
101-
$relatedId = $relatedClass->getIdentifierValues($criteria[$fieldName]);
102-
103-
if (count($relatedId) > 1) {
104-
throw new ConstraintDefinitionException(
105-
'Associated entities are not allowed to have more than one identifier field to be '.
106-
'part of a unique constraint in: '.$class->getName().'#'.$fieldName
107-
);
108-
}
109-
$criteria[$fieldName] = array_pop($relatedId);
11099
}
111100
}
112101

src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
150150
return;
151151
}
152152

153+
$resultMessage = 'Translation files were successfully updated';
154+
153155
// show compiled list of messages
154156
if (true === $input->getOption('dump-messages')) {
155157
$extractedMessagesCount = 0;
@@ -204,12 +206,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
204206
$writer->writeTranslations($operation->getResult(), $input->getOption('output-format'), array('path' => $bundleTransPath, 'default_locale' => $this->getContainer()->getParameter('kernel.default_locale')));
205207

206208
if (true === $input->getOption('dump-messages')) {
207-
$resultMessage .= ' and translation files were updated.';
208-
} else {
209-
$resultMessage = 'Translation files were successfully updated.';
209+
$resultMessage .= ' and translation files were updated';
210210
}
211211
}
212212

213-
$io->success($resultMessage);
213+
$io->success($resultMessage.'.');
214214
}
215215
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ public function getConfigTreeBuilder()
7070
}
7171

7272
if (false !== strpos($v, '/')) {
73+
if ('0.0.0.0/0' === $v) {
74+
return false;
75+
}
76+
7377
list($v, $mask) = explode('/', $v, 2);
7478

7579
if (strcmp($mask, (int) $mask) || $mask < 1 || $mask > (false !== strpos($v, ':') ? 128 : 32)) {

src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ public function testDumpMessagesAndClean()
2828
$tester = $this->createCommandTester($this->getContainer(array('foo' => 'foo')));
2929
$tester->execute(array('command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--dump-messages' => true, '--clean' => true));
3030
$this->assertRegExp('/foo/', $tester->getDisplay());
31+
$this->assertRegExp('/2 messages were successfully extracted/', $tester->getDisplay());
32+
}
33+
34+
public function testWriteMessages()
35+
{
36+
$tester = $this->createCommandTester($this->getContainer(array('foo' => 'foo')));
37+
$tester->execute(array('command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--force' => true));
38+
$this->assertRegExp('/Translation files were successfully updated./', $tester->getDisplay());
3139
}
3240

3341
protected function setUp()

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ public function getTestValidTrustedProxiesData()
6666
array(array(), array()),
6767
array(array('10.0.0.0/8'), array('10.0.0.0/8')),
6868
array(array('::ffff:0:0/96'), array('::ffff:0:0/96')),
69+
array(array('0.0.0.0/0'), array('0.0.0.0/0')),
6970
);
7071
}
7172

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@
225225
path = url.substr({{ (request.schemeAndHttpHost ~ request.basePath)|length }});
226226
}
227227
228-
if (path.substr(0, 1) === '/' && !path.match(new RegExp({{ excluded_ajax_paths|json_encode|raw }}))) {
228+
if (!path.match(new RegExp({{ excluded_ajax_paths|json_encode|raw }}))) {
229229
var stackElement = {
230230
loading: true,
231231
error: false,

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,11 @@ tr.status-warning td {
619619
width: 50px;
620620
text-align: center;
621621
}
622+
#menu-profiler .label .icon img,
623+
#menu-profiler .label .icon svg {
624+
height: 24px;
625+
max-width: 24px;
626+
}
622627
#menu-profiler li a .label .icon svg path {
623628
fill: #DDD;
624629
}

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@
5353
}
5454
.sf-toolbarreset svg,
5555
.sf-toolbarreset img {
56-
max-height: 20px;
57-
max-width: 20px;
56+
height: 20px;
5857
}
5958

6059
.sf-toolbarreset .hide-button {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="sf-toolbar-block sf-toolbar-block-{{ name }} sf-toolbar-status-{{ status|default('normal') }} {{ additional_classes|default('') }}">
2-
{% if link %}<a href="{{ path('_profiler', { token: token, panel: name }) }}">{% endif %}
2+
{% if link|default(true) %}<a href="{{ path('_profiler', { token: token, panel: name }) }}">{% endif %}
33
<div class="sf-toolbar-icon">{{ icon|default('') }}</div>
4-
{% if link %}</a>{% endif %}
4+
{% if link|default(true) %}</a>{% endif %}
55
<div class="sf-toolbar-info">{{ text|default('') }}</div>
66
</div>

src/Symfony/Component/ClassLoader/Tests/ApcClassLoaderTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,12 @@
1414
use Symfony\Component\ClassLoader\ApcClassLoader;
1515
use Symfony\Component\ClassLoader\ClassLoader;
1616

17-
/**
18-
* @requires extension apcu
19-
*/
2017
class ApcClassLoaderTest extends \PHPUnit_Framework_TestCase
2118
{
2219
protected function setUp()
2320
{
2421
if (!(ini_get('apc.enabled') && ini_get('apc.enable_cli'))) {
25-
$this->markTestSkipped('The apc extension is available, but not enabled.');
22+
$this->markTestSkipped('The apc extension is not enabled.');
2623
} else {
2724
apcu_clear_cache();
2825
}

src/Symfony/Component/ClassLoader/composer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@
1717
],
1818
"minimum-stability": "dev",
1919
"require": {
20+
<<<<<<< HEAD
2021
"php": ">=5.5.9"
22+
=======
23+
"php": ">=5.3.9",
24+
"symfony/polyfill-apcu": "~1.1"
25+
>>>>>>> 2.8
2126
},
2227
"require-dev": {
2328
"symfony/finder": "~2.8|~3.0"

src/Symfony/Component/Debug/ErrorHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ public function setExceptionHandler(callable $handler = null)
259259
public function throwAt($levels, $replace = false)
260260
{
261261
$prev = $this->thrownErrors;
262-
$this->thrownErrors = E_ALL & ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED;
262+
$this->thrownErrors = ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED;
263263
if (!$replace) {
264264
$this->thrownErrors |= $prev;
265265
}

src/Symfony/Component/HttpFoundation/Response.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ class Response
6767
const HTTP_PRECONDITION_REQUIRED = 428; // RFC6585
6868
const HTTP_TOO_MANY_REQUESTS = 429; // RFC6585
6969
const HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431; // RFC6585
70+
const HTTP_UNAVAILABLE_FOR_LEGAL_REASONS = 451;
7071
const HTTP_INTERNAL_SERVER_ERROR = 500;
7172
const HTTP_NOT_IMPLEMENTED = 501;
7273
const HTTP_BAD_GATEWAY = 502;
@@ -169,6 +170,7 @@ class Response
169170
428 => 'Precondition Required', // RFC6585
170171
429 => 'Too Many Requests', // RFC6585
171172
431 => 'Request Header Fields Too Large', // RFC6585
173+
451 => 'Unavailable For Legal Reasons',
172174
500 => 'Internal Server Error',
173175
501 => 'Not Implemented',
174176
502 => 'Bad Gateway',

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ protected function lock(Request $request, Response $entry)
544544
$wait += 50000;
545545
}
546546

547-
if ($wait < 2000000) {
547+
if ($wait < 5000000) {
548548
// replace the current entry with the fresh one
549549
$new = $this->lookup($request);
550550
$entry->headers = $new->headers;

src/Symfony/Component/Security/Core/User/UserInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ interface UserInterface
4747
* and populated in any number of different ways when the user object
4848
* is created.
4949
*
50-
* @return Role[] The user roles
50+
* @return (Role|string)[] The user roles
5151
*/
5252
public function getRoles();
5353

0 commit comments

Comments
 (0)