Skip to content

Navigation Menu

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 1bf4341

Browse filesBrowse files
committed
Merge branch '5.2' into 5.x
* 5.2: [HttpFoundation] Make test pass without Xdebug. [Mime] Leverage PHP 8's detection of CSV files. [HttpFoundation] Make sure we reuse the current PHP binary for the webserver process in functional tests. [FrameworkBundle] TextDescriptor::formatControllerLink checked method… Fix CS [HttpClient] throw clearer error when no scheme is provided Fix github pr template and include 5.2 for bugfixes [HttpFoundation] Ignore stack trace printed by Xdebug 3. fix lexing backslashes in single quoted strings
2 parents 21d4c09 + 72abcc3 commit 1bf4341
Copy full SHA for 1bf4341

File tree

12 files changed

+53
-7
lines changed
Filter options

12 files changed

+53
-7
lines changed

‎.github/PULL_REQUEST_TEMPLATE.md

Copy file name to clipboardExpand all lines: .github/PULL_REQUEST_TEMPLATE.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
| Q | A
22
| ------------- | ---
3-
| Branch? | 5.x for features / 4.4 or 5.1 for bug fixes <!-- see below -->
3+
| Branch? | 5.x for features / 4.4, 5.1 or 5.2 for bug fixes <!-- see below -->
44
| Bug fix? | yes/no
55
| New feature? | yes/no <!-- please update src/**/CHANGELOG.md files -->
66
| Deprecations? | yes/no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->

‎src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,9 @@ private function formatControllerLink($controller, string $anchorText, callable
535535
}
536536

537537
try {
538-
if (\is_array($controller)) {
538+
if (null === $controller) {
539+
return $anchorText;
540+
} elseif (\is_array($controller)) {
539541
$r = new \ReflectionMethod($controller[0], $controller[1]);
540542
} elseif ($controller instanceof \Closure) {
541543
$r = new \ReflectionFunction($controller);

‎src/Symfony/Component/HttpClient/HttpClientTrait.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpClient/HttpClientTrait.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,10 @@ private static function resolveUrl(array $url, ?array $base, array $queryDefault
391391
throw new InvalidArgumentException(sprintf('Invalid "base_uri" option: host or scheme is missing in "%s".', implode('', $base)));
392392
}
393393

394+
if (null === $url['scheme'] && (null === $base || null === $base['scheme'])) {
395+
throw new InvalidArgumentException(sprintf('Invalid URL: scheme is missing in "%s". Did you forget to add "http(s)://"?', implode('', $base ?? $url)));
396+
}
397+
394398
if (null === $base && '' === $url['scheme'].$url['authority']) {
395399
throw new InvalidArgumentException(sprintf('Invalid URL: no "base_uri" option was provided and host or scheme is missing in "%s".', implode('', $url)));
396400
}

‎src/Symfony/Component/HttpClient/Tests/HttpClientTraitTest.php

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

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Component\HttpClient\Exception\InvalidArgumentException;
1516
use Symfony\Component\HttpClient\HttpClientTrait;
1617
use Symfony\Contracts\HttpClient\HttpClientInterface;
1718

@@ -120,6 +121,20 @@ public function provideResolveUrl(): array
120121
];
121122
}
122123

124+
public function testResolveUrlWithoutScheme()
125+
{
126+
$this->expectException(InvalidArgumentException::class);
127+
$this->expectExceptionMessage('Invalid URL: scheme is missing in "//localhost:8080". Did you forget to add "http(s)://"?');
128+
self::resolveUrl(self::parseUrl('localhost:8080'), null);
129+
}
130+
131+
public function testResolveBaseUrlWitoutScheme()
132+
{
133+
$this->expectException(InvalidArgumentException::class);
134+
$this->expectExceptionMessage('Invalid URL: scheme is missing in "//localhost:8081". Did you forget to add "http(s)://"?');
135+
self::resolveUrl(self::parseUrl('/foo'), self::parseUrl('localhost:8081'));
136+
}
137+
123138
/**
124139
* @dataProvider provideParseUrl
125140
*/

‎src/Symfony/Component/HttpFoundation/Tests/Fixtures/response-functional/cookie_max_age.expected

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Tests/Fixtures/response-functional/cookie_max_age.expected
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
Warning: Expiry date cannot have a year greater than 9999 in %scookie_max_age.php on line 10
3-
3+
%A
44
Array
55
(
66
[0] => Content-Type: text/plain; charset=utf-8

‎src/Symfony/Component/HttpFoundation/Tests/ResponseFunctionalTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Tests/ResponseFunctionalTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public static function setUpBeforeClass(): void
2323
1 => ['file', '/dev/null', 'w'],
2424
2 => ['file', '/dev/null', 'w'],
2525
];
26-
if (!self::$server = @proc_open('exec php -S localhost:8054', $spec, $pipes, __DIR__.'/Fixtures/response-functional')) {
26+
if (!self::$server = @proc_open('exec '.\PHP_BINARY.' -S localhost:8054', $spec, $pipes, __DIR__.'/Fixtures/response-functional')) {
2727
self::markTestSkipped('PHP server unable to start.');
2828
}
2929
sleep(1);

‎src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public static function setUpBeforeClass(): void
2323
1 => ['file', '/dev/null', 'w'],
2424
2 => ['file', '/dev/null', 'w'],
2525
];
26-
if (!self::$server = @proc_open('exec php -S localhost:8053', $spec, $pipes, __DIR__.'/Fixtures')) {
26+
if (!self::$server = @proc_open('exec '.\PHP_BINARY.' -S localhost:8053', $spec, $pipes, __DIR__.'/Fixtures')) {
2727
self::markTestSkipped('PHP server unable to start.');
2828
}
2929
sleep(1);

‎src/Symfony/Component/Mime/MimeTypes.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Mime/MimeTypes.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ public function guessMimeType(string $path): ?string
173173
'application/cdmi-queue' => ['cdmiq'],
174174
'application/cdr' => ['cdr'],
175175
'application/coreldraw' => ['cdr'],
176+
'application/csv' => ['csv'],
176177
'application/cu-seeme' => ['cu'],
177178
'application/dash+xml' => ['mpd'],
178179
'application/davmount+xml' => ['davmount'],
@@ -1960,7 +1961,7 @@ public function guessMimeType(string $path): ?string
19601961
'csp' => ['application/vnd.commonspace'],
19611962
'css' => ['text/css'],
19621963
'cst' => ['application/x-director'],
1963-
'csv' => ['text/csv', 'text/x-comma-separated-values', 'text/x-csv'],
1964+
'csv' => ['text/csv', 'text/x-comma-separated-values', 'text/x-csv', 'application/csv'],
19641965
'csvs' => ['text/csv-schema'],
19651966
'cu' => ['application/cu-seeme'],
19661967
'cue' => ['application/x-cue'],
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
a,b,c
2+
d,e,f
3+
g,h,i

‎src/Symfony/Component/Mime/Tests/MimeTypesTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Mime/Tests/MimeTypesTest.php
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,18 @@ public function testCustomMimeTypes()
7373
$this->assertContains('text/baz', $mt->getMimeTypes('foo'));
7474
$this->assertSame(['foo', 'moof'], $mt->getExtensions('text/baz'));
7575
}
76+
77+
/**
78+
* PHP 8 detects .csv files as "application/csv" while PHP 7 returns "text/plain".
79+
*
80+
* @requires PHP 8
81+
*/
82+
public function testCsvExtension()
83+
{
84+
$mt = new MimeTypes();
85+
86+
$mime = $mt->guessMimeType(__DIR__.'/Fixtures/mimetypes/abc.csv');
87+
$this->assertSame('application/csv', $mime);
88+
$this->assertSame(['csv'], $mt->getExtensions($mime));
89+
}
7690
}

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Parser.php
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1178,7 +1178,9 @@ private function lexInlineQuotedString(int &$cursor = 0): string
11781178
for (; \strlen($this->currentLine) > $cursor; ++$cursor) {
11791179
switch ($this->currentLine[$cursor]) {
11801180
case '\\':
1181-
if (isset($this->currentLine[++$cursor])) {
1181+
if ("'" === $quotation) {
1182+
$value .= '\\';
1183+
} elseif (isset($this->currentLine[++$cursor])) {
11821184
$value .= '\\'.$this->currentLine[$cursor];
11831185
}
11841186

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Tests/ParserTest.php
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,6 +1617,11 @@ public function escapedQuotationCharactersInQuotedStrings()
16171617
];
16181618
}
16191619

1620+
public function testBackslashInSingleQuotedString()
1621+
{
1622+
$this->assertSame(['foo' => 'bar\\'], $this->parser->parse("foo: 'bar\'"));
1623+
}
1624+
16201625
public function testParseMultiLineString()
16211626
{
16221627
$this->assertEquals("foo bar\nbaz", $this->parser->parse("foo\nbar\n\nbaz"));

0 commit comments

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