Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b8c4809

Browse filesBrowse files
Merge branch '3.4' into 4.2
* 3.4: [HttpFoundation] Throw exception when the \"session\" extension is not loaded remove invalid test cases [Serializer] Fixed PHP of DenormalizableInterface::denormalize [Finder] docblock fixes pass error code as a string Catch JsonException and rethrow in JsonEncode
2 parents 3f16506 + b6e8b17 commit b8c4809
Copy full SHA for b8c4809

File tree

Expand file treeCollapse file tree

9 files changed

+26
-23
lines changed
Filter options
Expand file treeCollapse file tree

9 files changed

+26
-23
lines changed

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,10 @@ public function load(array $configs, ContainerBuilder $container)
210210
}
211211

212212
if ($this->isConfigEnabled($container, $config['session'])) {
213+
if (!\extension_loaded('session')) {
214+
throw new \LogicException('PHP extension "session" is required.');
215+
}
216+
213217
$this->sessionConfigEnabled = true;
214218
$this->registerSessionConfiguration($config['session'], $container, $loader);
215219
if (!empty($config['test'])) {

‎src/Symfony/Component/Finder/Finder.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Finder/Finder.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ public function ignoreUnreadableDirs($ignore = true)
562562
/**
563563
* Searches files and directories which match defined rules.
564564
*
565-
* @param string|array $dirs A directory path or an array of directories
565+
* @param string|string[] $dirs A directory path or an array of directories
566566
*
567567
* @return $this
568568
*

‎src/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class ExcludeDirectoryFilterIterator extends \FilterIterator implements \Recursi
2525

2626
/**
2727
* @param \Iterator $iterator The Iterator to filter
28-
* @param array $directories An array of directories to exclude
28+
* @param string[] $directories An array of directories to exclude
2929
*/
3030
public function __construct(\Iterator $iterator, array $directories)
3131
{

‎src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ class NativeSessionStorage implements SessionStorageInterface
103103
*/
104104
public function __construct(array $options = [], $handler = null, MetadataBag $metaBag = null)
105105
{
106+
if (!\extension_loaded('session')) {
107+
throw new \LogicException('PHP extension "session" is required.');
108+
}
109+
106110
$options += [
107111
'cache_limiter' => '',
108112
'cache_expire' => 0,

‎src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ class PhpBridgeSessionStorage extends NativeSessionStorage
2424
*/
2525
public function __construct($handler = null, MetadataBag $metaBag = null)
2626
{
27+
if (!\extension_loaded('session')) {
28+
throw new \LogicException('PHP extension "session" is required.');
29+
}
30+
2731
$this->setMetadataBag($metaBag);
2832
$this->setSaveHandler($handler);
2933
}

‎src/Symfony/Component/Serializer/Encoder/JsonEncode.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Encoder/JsonEncode.php
+9-4Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,19 @@ public function __construct($defaultContext = [])
4747
*/
4848
public function encode($data, $format, array $context = [])
4949
{
50-
$jsonEncodeOptions = $context[self::OPTIONS] ?? $this->defaultContext[self::OPTIONS];
51-
$encodedJson = json_encode($data, $jsonEncodeOptions);
50+
$options = $context[self::OPTIONS] ?? $this->defaultContext[self::OPTIONS];
5251

53-
if (\PHP_VERSION_ID >= 70300 && (JSON_THROW_ON_ERROR & $jsonEncodeOptions)) {
52+
try {
53+
$encodedJson = json_encode($data, $options);
54+
} catch (\JsonException $e) {
55+
throw new NotEncodableValueException($e->getMessage(), 0, $e);
56+
}
57+
58+
if (\PHP_VERSION_ID >= 70300 && (JSON_THROW_ON_ERROR & $options)) {
5459
return $encodedJson;
5560
}
5661

57-
if (JSON_ERROR_NONE !== json_last_error() && (false === $encodedJson || !($jsonEncodeOptions & JSON_PARTIAL_OUTPUT_ON_ERROR))) {
62+
if (JSON_ERROR_NONE !== json_last_error() && (false === $encodedJson || !($options & JSON_PARTIAL_OUTPUT_ON_ERROR))) {
5863
throw new NotEncodableValueException(json_last_error_msg());
5964
}
6065

‎src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ interface DenormalizableInterface
3434
* differently based on different input formats
3535
* @param array $context Options for denormalizing
3636
*
37-
* @return object
37+
* @return object|object[]
3838
*/
3939
public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = []);
4040
}

‎src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php
-14Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -148,20 +148,6 @@ public function testValidComparisonToPropertyPath($comparedValue)
148148
$this->assertNoViolation();
149149
}
150150

151-
/**
152-
* @dataProvider provideValidComparisonsToPropertyPath
153-
*/
154-
public function testValidComparisonToPropertyPathOnArray($comparedValue)
155-
{
156-
$constraint = $this->createConstraint(['propertyPath' => '[root][value]']);
157-
158-
$this->setObject(['root' => ['value' => 5]]);
159-
160-
$this->validator->validate($comparedValue, $constraint);
161-
162-
$this->assertNoViolation();
163-
}
164-
165151
public function testNoViolationOnNullObjectWithPropertyPath()
166152
{
167153
$constraint = $this->createConstraint(['propertyPath' => 'propertyPath']);

‎src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ public function testAddCustomizedViolation()
511511
->setParameter('%param%', 'value')
512512
->setInvalidValue('Invalid value')
513513
->setPlural(2)
514-
->setCode(42)
514+
->setCode('42')
515515
->addViolation();
516516
};
517517

@@ -528,7 +528,7 @@ public function testAddCustomizedViolation()
528528
$this->assertSame($entity, $violations[0]->getRoot());
529529
$this->assertSame('Invalid value', $violations[0]->getInvalidValue());
530530
$this->assertSame(2, $violations[0]->getPlural());
531-
$this->assertSame(42, $violations[0]->getCode());
531+
$this->assertSame('42', $violations[0]->getCode());
532532
}
533533

534534
public function testNoDuplicateValidationIfClassConstraintInMultipleGroups()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.