Skip to content

Commit fe14e38

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: 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 [DoctrineBridge][Validator] >= 2.3 Pass association instead of ID as argument 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 [HttpKernel] Lookup the response even if the lock was released after 2 seconds
2 parents e66d33f + ce0946d commit fe14e38

File tree

15 files changed

+23
-55
lines changed

15 files changed

+23
-55
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"twig/twig": "~1.23|~2.0",
2222
"psr/log": "~1.0",
2323
"symfony/security-acl": "~2.7",
24-
"symfony/polyfill-apcu": "~1.0,>=1.0.2",
24+
"symfony/polyfill-apcu": "~1.1",
2525
"symfony/polyfill-intl-icu": "~1.0",
2626
"symfony/polyfill-mbstring": "~1.0",
2727
"symfony/polyfill-php54": "~1.0",

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;
@@ -404,7 +403,7 @@ public function testAssociatedEntity()
404403

405404
$this->buildViolation('myMessage')
406405
->atPath('property.path.single')
407-
->setInvalidValue(1)
406+
->setInvalidValue($entity1)
408407
->assertRaised();
409408
}
410409

@@ -428,29 +427,6 @@ public function testAssociatedEntityWithNull()
428427
$this->assertNoViolation();
429428
}
430429

431-
/**
432-
* @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
433-
* @expectedExceptionMessage Associated entities are not allowed to have more than one identifier field
434-
*/
435-
public function testAssociatedCompositeEntity()
436-
{
437-
$constraint = new UniqueEntity(array(
438-
'message' => 'myMessage',
439-
'fields' => array('composite'),
440-
'em' => self::EM_NAME,
441-
));
442-
443-
$composite = new CompositeIntIdEntity(1, 1, 'test');
444-
$associated = new AssociationEntity();
445-
$associated->composite = $composite;
446-
447-
$this->em->persist($composite);
448-
$this->em->persist($associated);
449-
$this->em->flush();
450-
451-
$this->validator->validate($associated, $constraint);
452-
}
453-
454430
/**
455431
* @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
456432
* @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
@@ -97,17 +97,6 @@ public function validate($entity, Constraint $constraint)
9797
* getter methods in the Proxy are being bypassed.
9898
*/
9999
$em->initializeObject($criteria[$fieldName]);
100-
101-
$relatedClass = $em->getClassMetadata($class->getAssociationTargetClass($fieldName));
102-
$relatedId = $relatedClass->getIdentifierValues($criteria[$fieldName]);
103-
104-
if (count($relatedId) > 1) {
105-
throw new ConstraintDefinitionException(
106-
'Associated entities are not allowed to have more than one identifier field to be '.
107-
'part of a unique constraint in: '.$class->getName().'#'.$fieldName
108-
);
109-
}
110-
$criteria[$fieldName] = array_pop($relatedId);
111100
}
112101
}
113102

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

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

141141
if (false !== strpos($v, '/')) {
142+
if ('0.0.0.0/0' === $v) {
143+
return false;
144+
}
145+
142146
list($v, $mask) = explode('/', $v, 2);
143147

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

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,
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/ApcUniversalClassLoader.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class ApcUniversalClassLoader extends UniversalClassLoader
7676
*/
7777
public function __construct($prefix)
7878
{
79-
if (!extension_loaded('apc')) {
79+
if (!function_exists('apcu_fetch')) {
8080
throw new \RuntimeException('Unable to use ApcUniversalClassLoader as APC is not enabled.');
8181
}
8282

@@ -92,8 +92,8 @@ public function __construct($prefix)
9292
*/
9393
public function findFile($class)
9494
{
95-
if (false === $file = apc_fetch($this->prefix.$class)) {
96-
apc_store($this->prefix.$class, $file = parent::findFile($class));
95+
if (false === $file = apcu_fetch($this->prefix.$class)) {
96+
apcu_store($this->prefix.$class, $file = parent::findFile($class));
9797
}
9898

9999
return $file;

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 apc
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/Tests/LegacyApcUniversalClassLoaderTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@
1515

1616
/**
1717
* @group legacy
18-
* @requires extension apc
1918
*/
2019
class LegacyApcUniversalClassLoaderTest extends \PHPUnit_Framework_TestCase
2120
{
2221
protected function setUp()
2322
{
2423
if (ini_get('apc.enabled') && ini_get('apc.enable_cli')) {
25-
apc_clear_cache('user');
24+
apcu_clear_cache('user');
2625
} else {
2726
$this->markTestSkipped('APC is not enabled.');
2827
}
@@ -31,7 +30,7 @@ protected function setUp()
3130
protected function tearDown()
3231
{
3332
if (ini_get('apc.enabled') && ini_get('apc.enable_cli')) {
34-
apc_clear_cache('user');
33+
apcu_clear_cache('user');
3534
}
3635
}
3736

@@ -40,7 +39,7 @@ public function testConstructor()
4039
$loader = new ApcUniversalClassLoader('test.prefix.');
4140
$loader->registerNamespace('LegacyApc\Namespaced', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
4241

43-
$this->assertEquals($loader->findFile('\LegacyApc\Namespaced\FooBar'), apc_fetch('test.prefix.\LegacyApc\Namespaced\FooBar'), '__construct() takes a prefix as its first argument');
42+
$this->assertEquals($loader->findFile('\LegacyApc\Namespaced\FooBar'), apcu_fetch('test.prefix.\LegacyApc\Namespaced\FooBar'), '__construct() takes a prefix as its first argument');
4443
}
4544

4645
/**

src/Symfony/Component/ClassLoader/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"minimum-stability": "dev",
1919
"require": {
2020
"php": ">=5.3.9",
21-
"symfony/polyfill-apcu": "~1.0,>=1.0.2"
21+
"symfony/polyfill-apcu": "~1.1"
2222
},
2323
"require-dev": {
2424
"symfony/finder": "~2.0,>=2.0.5|~3.0.0"

src/Symfony/Component/Debug/ErrorHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ public function setExceptionHandler($handler)
283283
public function throwAt($levels, $replace = false)
284284
{
285285
$prev = $this->thrownErrors;
286-
$this->thrownErrors = (E_ALL | E_STRICT) & ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED;
286+
$this->thrownErrors = ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED;
287287
if (!$replace) {
288288
$this->thrownErrors |= $prev;
289289
}

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
@@ -566,7 +566,7 @@ protected function lock(Request $request, Response $entry)
566566
$wait += 50000;
567567
}
568568

569-
if ($wait < 2000000) {
569+
if ($wait < 5000000) {
570570
// replace the current entry with the fresh one
571571
$new = $this->lookup($request);
572572
$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)