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 8d4e3c5

Browse filesBrowse files
Merge branch '3.3' into 3.4
* 3.3: Have weak_vendors ignore deprecations from outside [HttpFoundation] fixed return type of method HeaderBag::get [HttpFoundation] Added "resource" type on Request::create docblock [Process] Skip environment variables with false value in Process Revert "bug #25789 Enableable ArrayNodeDefinition is disabled for empty configuration (kejwmen)" Formatting fix in upgrade 3.0 document don't split lines on carriage returns when dumping Revert "bug #25851 [Validator] Conflict with egulias/email-validator 2.0 (emodric)" [DI] compilation perf tweak [Validator] Conflict with egulias/email-validator 2.0 [Validator] add missing parent isset and add test
2 parents d2a316f + fa7b760 commit 8d4e3c5
Copy full SHA for 8d4e3c5

File tree

18 files changed

+108
-57
lines changed
Filter options

18 files changed

+108
-57
lines changed

‎src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,12 @@ public static function register($mode = 0)
7575
}
7676
}
7777
}
78-
$path = realpath($path) ?: $path;
78+
$realPath = realpath($path);
79+
if (false === $realPath && '-' !== $path && 'Standard input code' !== $path) {
80+
return true;
81+
}
7982
foreach ($vendors as $vendor) {
80-
if (0 === strpos($path, $vendor) && false !== strpbrk(substr($path, strlen($vendor), 1), '/'.DIRECTORY_SEPARATOR)) {
83+
if (0 === strpos($realPath, $vendor) && false !== strpbrk(substr($realPath, strlen($vendor), 1), '/'.DIRECTORY_SEPARATOR)) {
8184
return true;
8285
}
8386
}
Binary file not shown.
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
3+
@trigger_error('I come from… afar! :D', E_USER_DEPRECATED);
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?php
2+
3+
$phar = new Phar(__DIR__.DIRECTORY_SEPARATOR.'deprecation.phar', 0, 'deprecation.phar');
4+
$phar->buildFromDirectory(__DIR__.DIRECTORY_SEPARATOR.'deprecation');
+23Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--TEST--
2+
Test DeprecationErrorHandler in weak vendors mode on eval()'d deprecation
3+
--FILE--
4+
<?php
5+
6+
putenv('SYMFONY_DEPRECATIONS_HELPER=weak_vendors');
7+
putenv('ANSICON');
8+
putenv('ConEmuANSI');
9+
putenv('TERM');
10+
11+
$vendor = __DIR__;
12+
while (!file_exists($vendor.'/vendor')) {
13+
$vendor = dirname($vendor);
14+
}
15+
define('PHPUNIT_COMPOSER_INSTALL', $vendor.'/vendor/autoload.php');
16+
require PHPUNIT_COMPOSER_INSTALL;
17+
require_once __DIR__.'/../../bootstrap.php';
18+
eval("@trigger_error('who knows where I come from?', E_USER_DEPRECATED);")
19+
20+
?>
21+
--EXPECTF--
22+
23+
Other deprecation notices (1)
+25Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
Test DeprecationErrorHandler in weak vendors mode on eval()'d deprecation
3+
The phar can be regenerated by running php src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/generate_phar.php
4+
--FILE--
5+
<?php
6+
7+
putenv('SYMFONY_DEPRECATIONS_HELPER=weak_vendors');
8+
putenv('ANSICON');
9+
putenv('ConEmuANSI');
10+
putenv('TERM');
11+
12+
$vendor = __DIR__;
13+
while (!file_exists($vendor.'/vendor')) {
14+
$vendor = dirname($vendor);
15+
}
16+
define('PHPUNIT_COMPOSER_INSTALL', $vendor.'/vendor/autoload.php');
17+
require PHPUNIT_COMPOSER_INSTALL;
18+
require_once __DIR__.'/../../bootstrap.php';
19+
\Phar::loadPhar(__DIR__.'/deprecation.phar', 'deprecation.phar');
20+
include 'phar://deprecation.phar/deprecation.php';
21+
22+
?>
23+
--EXPECTF--
24+
25+
Other deprecation notices (1)

‎src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,7 @@ public function canBeEnabled()
283283
->beforeNormalization()
284284
->ifArray()
285285
->then(function ($v) {
286-
if (!isset($v['enabled'])) {
287-
$v['enabled'] = !empty($v);
288-
}
286+
$v['enabled'] = isset($v['enabled']) ? $v['enabled'] : true;
289287

290288
return $v;
291289
})

‎src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php
-15Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -207,20 +207,6 @@ public function testCanBeDisabled()
207207
$this->assertTrue($this->getField($enabledNode, 'defaultValue'));
208208
}
209209

210-
public function testEnableableNodeIsDisabledForEmptyConfigurationWhenNormalized()
211-
{
212-
$config = array();
213-
214-
$node = new ArrayNodeDefinition('root');
215-
$node->canBeEnabled();
216-
217-
$this->assertEquals(
218-
array('enabled' => false),
219-
$node->getNode()->normalize($config),
220-
'An enableable node is disabled by default'
221-
);
222-
}
223-
224210
public function testIgnoreExtraKeys()
225211
{
226212
$node = new ArrayNodeDefinition('root');
@@ -296,7 +282,6 @@ public function getEnableableNodeFixtures()
296282
array(array('enabled' => true, 'foo' => 'baz'), array(array('foo' => 'baz')), 'any configuration enables an enableable node'),
297283
array(array('enabled' => false, 'foo' => 'baz'), array(array('foo' => 'baz', 'enabled' => false)), 'An enableable node can be disabled'),
298284
array(array('enabled' => false, 'foo' => 'bar'), array(false), 'false disables an enableable node'),
299-
array(array('enabled' => false, 'foo' => 'bar'), array(), 'enableable node is disabled by default'),
300285
);
301286
}
302287

‎src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php
-19Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\Config\Tests\Definition\Builder;
1313

1414
use PHPUnit\Framework\TestCase;
15-
use Symfony\Component\Config\Definition\Processor;
1615
use Symfony\Component\Config\Tests\Fixtures\Builder\NodeBuilder as CustomNodeBuilder;
1716
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
1817

@@ -132,22 +131,4 @@ public function testDefinitionExampleGetsTransferredToNode()
132131
$this->assertInternalType('array', $tree->getExample());
133132
$this->assertEquals('example', $children['child']->getExample());
134133
}
135-
136-
public function testRootNodeThatCanBeEnabledIsDisabledByDefault()
137-
{
138-
$builder = new TreeBuilder();
139-
140-
$builder->root('test')
141-
->canBeEnabled();
142-
143-
$tree = $builder->buildTree();
144-
$children = $tree->getChildren();
145-
146-
$this->assertFalse($children['enabled']->getDefaultValue());
147-
148-
$processor = new Processor();
149-
$result = $processor->process($tree, array());
150-
151-
$this->assertEquals(array('enabled' => false), $result);
152-
}
153134
}

‎src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function process(ContainerBuilder $container)
5252
*/
5353
protected function processValue($value, $isRoot = false)
5454
{
55-
if (is_array($value)) {
55+
if (\is_array($value)) {
5656
foreach ($value as $k => $v) {
5757
if ($isRoot) {
5858
$this->currentId = $k;

‎src/Symfony/Component/HttpFoundation/HeaderBag.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/HeaderBag.php
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ public function add(array $headers)
101101
/**
102102
* Returns a header value by name.
103103
*
104-
* @param string $key The header name
105-
* @param mixed $default The default value
106-
* @param bool $first Whether to return the first value or all header values
104+
* @param string $key The header name
105+
* @param string|string[] $default The default value
106+
* @param bool $first Whether to return the first value or all header values
107107
*
108-
* @return string|array The first header value if $first is true, an array of values otherwise
108+
* @return string|string[] The first header value or default value if $first is true, an array of values otherwise
109109
*/
110110
public function get($key, $default = null, $first = true)
111111
{
@@ -130,9 +130,9 @@ public function get($key, $default = null, $first = true)
130130
/**
131131
* Sets a header by name.
132132
*
133-
* @param string $key The key
134-
* @param string|array $values The value or an array of values
135-
* @param bool $replace Whether to replace the actual value or not (true by default)
133+
* @param string $key The key
134+
* @param string|string[] $values The value or an array of values
135+
* @param bool $replace Whether to replace the actual value or not (true by default)
136136
*/
137137
public function set($key, $values, $replace = true)
138138
{

‎src/Symfony/Component/HttpFoundation/Request.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Request.php
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -329,13 +329,13 @@ public static function createFromGlobals()
329329
* The information contained in the URI always take precedence
330330
* over the other information (server and parameters).
331331
*
332-
* @param string $uri The URI
333-
* @param string $method The HTTP method
334-
* @param array $parameters The query (GET) or request (POST) parameters
335-
* @param array $cookies The request cookies ($_COOKIE)
336-
* @param array $files The request files ($_FILES)
337-
* @param array $server The server parameters ($_SERVER)
338-
* @param string $content The raw body data
332+
* @param string $uri The URI
333+
* @param string $method The HTTP method
334+
* @param array $parameters The query (GET) or request (POST) parameters
335+
* @param array $cookies The request cookies ($_COOKIE)
336+
* @param array $files The request files ($_FILES)
337+
* @param array $server The server parameters ($_SERVER)
338+
* @param string|resource $content The raw body data
339339
*
340340
* @return static
341341
*/

‎src/Symfony/Component/Process/Process.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Process/Process.php
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,9 @@ public function start(callable $callback = null/*, array $env = array()*/)
331331
} else {
332332
$envPairs = array();
333333
foreach ($env as $k => $v) {
334-
$envPairs[] = $k.'='.$v;
334+
if (false !== $v) {
335+
$envPairs[] = $k.'='.$v;
336+
}
335337
}
336338
}
337339

‎src/Symfony/Component/Validator/Constraint.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Constraint.php
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,16 @@ public function __get($option)
214214
throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint %s', $option, get_class($this)), array($option));
215215
}
216216

217+
/**
218+
* @param string $option The option name
219+
*
220+
* @return bool
221+
*/
222+
public function __isset($option)
223+
{
224+
return 'groups' === $option;
225+
}
226+
217227
/**
218228
* Adds the given group if this constraint is in the Default group.
219229
*

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Constraints/FileTest.php
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ public function testMaxSize($maxSize, $bytes, $binaryFormat)
2626

2727
$this->assertSame($bytes, $file->maxSize);
2828
$this->assertSame($binaryFormat, $file->binaryFormat);
29+
$this->assertTrue($file->__isset('maxSize'));
30+
}
31+
32+
public function testMagicIsset()
33+
{
34+
$file = new File(array('maxSize' => 1));
35+
36+
$this->assertTrue($file->__isset('maxSize'));
37+
$this->assertTrue($file->__isset('groups'));
38+
$this->assertFalse($file->__isset('toto'));
2939
}
3040

3141
/**

‎src/Symfony/Component/Yaml/Dumper.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Dumper.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function dump($input, $inline = 0, $indent = 0, $flags = 0)
9797
$dumpAsMap = Inline::isHash($input);
9898

9999
foreach ($input as $key => $value) {
100-
if ($inline >= 1 && Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && is_string($value) && false !== strpos($value, "\n")) {
100+
if ($inline >= 1 && Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && is_string($value) && false !== strpos($value, "\n") && false === strpos($value, "\r\n")) {
101101
$output .= sprintf("%s%s%s |\n", $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', '');
102102

103103
foreach (preg_split('/\n|\r\n/', $value) as $row) {

‎src/Symfony/Component/Yaml/Tests/DumperTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Tests/DumperTest.php
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,8 @@ public function testDumpMultiLineStringAsScalarBlock()
443443
$data = array(
444444
'data' => array(
445445
'single_line' => 'foo bar baz',
446-
'multi_line' => "foo\nline with trailing spaces:\n \nbar\r\ninteger like line:\n123456789\nempty line:\n\nbaz",
446+
'multi_line' => "foo\nline with trailing spaces:\n \nbar\ninteger like line:\n123456789\nempty line:\n\nbaz",
447+
'multi_line_with_carriage_return' => "foo\nbar\r\nbaz",
447448
'nested_inlined_multi_line_string' => array(
448449
'inlined_multi_line' => "foo\nbar\r\nempty line:\n\nbaz",
449450
),
@@ -453,6 +454,11 @@ public function testDumpMultiLineStringAsScalarBlock()
453454
$this->assertSame(file_get_contents(__DIR__.'/Fixtures/multiple_lines_as_literal_block.yml'), $this->dumper->dump($data, 2, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK));
454455
}
455456

457+
public function testCarriageReturnIsMaintainedWhenDumpingAsMultiLineLiteralBlock()
458+
{
459+
$this->assertSame("- \"a\\r\\nb\\nc\"\n", $this->dumper->dump(array("a\r\nb\nc"), 2, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK));
460+
}
461+
456462
/**
457463
* @expectedException \InvalidArgumentException
458464
* @expectedExceptionMessage The indentation must be greater than zero

‎src/Symfony/Component/Yaml/Tests/Fixtures/multiple_lines_as_literal_block.yml

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Tests/Fixtures/multiple_lines_as_literal_block.yml
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ data:
1010
empty line:
1111
1212
baz
13+
multi_line_with_carriage_return: "foo\nbar\r\nbaz"
1314
nested_inlined_multi_line_string: { inlined_multi_line: "foo\nbar\r\nempty line:\n\nbaz" }

0 commit comments

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