From a5f05a04864f67f6738ef83d734039a7b85cc5ac Mon Sep 17 00:00:00 2001 From: "changmin.keum" Date: Thu, 15 Feb 2018 14:08:21 +0900 Subject: [PATCH 01/12] [DI] Add null check for removeChild --- .../Component/DependencyInjection/Loader/XmlFileLoader.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php index 93ca3c669b..abf91b181c 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php @@ -324,7 +324,9 @@ class XmlFileLoader extends FileLoader $domElement->parentNode->replaceChild($tmpDomElement, $domElement); $tmpDomElement->setAttribute('id', $id); } else { - $domElement->parentNode->removeChild($domElement); + if (null !== $domElement->parentNode) { + $domElement->parentNode->removeChild($domElement); + } } } } From ba3e19ae21ce4c0cd93b402d262c2a749ecd00a6 Mon Sep 17 00:00:00 2001 From: Ian Jenkins Date: Thu, 15 Feb 2018 15:19:03 +0000 Subject: [PATCH 02/12] [HttpFoundation] Add x-zip-compressed to MimeTypeExtensionGuesser. Zip files uploaded on Windows often have a mime type of `x-zip-compressed`. This patch adds support for this mime type to `MimeTypeExtensionGuesser`. The mime type seems to be a valid mime type for zip files according to http://filext.com/file-extension/ZIP --- .../HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php b/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php index 49c323c1f5..36271afe4a 100644 --- a/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php +++ b/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php @@ -599,6 +599,7 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface 'application/x-xliff+xml' => 'xlf', 'application/x-xpinstall' => 'xpi', 'application/x-xz' => 'xz', + 'application/x-zip-compressed' => 'zip', 'application/x-zmachine' => 'z1', 'application/xaml+xml' => 'xaml', 'application/xcap-diff+xml' => 'xdf', From bc1b652b171fcdb6085ba0ffc7544552d5f9ff55 Mon Sep 17 00:00:00 2001 From: Wouter J Date: Tue, 30 Jan 2018 22:23:40 +0100 Subject: [PATCH 03/12] Added a README entry to the PR template --- .github/PULL_REQUEST_TEMPLATE.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index e51cf88761..f52d3571ce 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -11,8 +11,10 @@ | Doc PR | symfony/symfony-docs#... From b32fdf1ca3ae87098876a761b1cf128852842517 Mon Sep 17 00:00:00 2001 From: Greg Anderson Date: Mon, 12 Feb 2018 14:05:44 -0800 Subject: [PATCH 04/12] Fixes #26136: Avoid emitting warning in hasParameterOption() --- src/Symfony/Component/Console/Input/ArgvInput.php | 4 ++-- .../Console/Tests/Input/ArgvInputTest.php | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Console/Input/ArgvInput.php b/src/Symfony/Component/Console/Input/ArgvInput.php index da064598d0..62c658b4f9 100644 --- a/src/Symfony/Component/Console/Input/ArgvInput.php +++ b/src/Symfony/Component/Console/Input/ArgvInput.php @@ -283,7 +283,7 @@ class ArgvInput extends Input // For long options, test for '--option=' at beginning // For short options, test for '-o' at beginning $leading = 0 === strpos($value, '--') ? $value.'=' : $value; - if ($token === $value || 0 === strpos($token, $leading)) { + if ($token === $value || '' !== $leading && 0 === strpos($token, $leading)) { return true; } } @@ -311,7 +311,7 @@ class ArgvInput extends Input // For long options, test for '--option=' at beginning // For short options, test for '-o' at beginning $leading = 0 === strpos($value, '--') ? $value.'=' : $value; - if (0 === strpos($token, $leading)) { + if ('' !== $leading && 0 === strpos($token, $leading)) { return substr($token, strlen($leading)); } } diff --git a/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php b/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php index 04f5ce3157..c2a277a93f 100644 --- a/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php +++ b/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php @@ -337,6 +337,21 @@ class ArgvInputTest extends TestCase $this->assertFalse($input->hasParameterOption('-fh'), '->hasParameterOption() returns true if the given short option is in the raw input'); } + public function testNoWarningOnInvalidParameterOption() + { + $input = new ArgvInput(array('cli.php', '-edev')); + + // Control. + $this->assertTrue($input->hasParameterOption(array('-e', ''))); + // No warning is thrown if https://github.com/symfony/symfony/pull/26156 is fixed + $this->assertFalse($input->hasParameterOption(array('-m', ''))); + + // Control. + $this->assertEquals('dev', $input->getParameterOption(array('-e', ''))); + // No warning is thrown if https://github.com/symfony/symfony/pull/26156 is fixed + $this->assertFalse($input->getParameterOption(array('-m', ''))); + } + public function testToString() { $input = new ArgvInput(array('cli.php', '-f', 'foo')); From 800cadfb82fd072e75b88f0cca3be6207b9c3263 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 16 Feb 2018 06:42:51 +0100 Subject: [PATCH 05/12] removed extra-verbose comments --- src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php b/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php index c2a277a93f..5f813ee39f 100644 --- a/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php +++ b/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php @@ -341,14 +341,12 @@ class ArgvInputTest extends TestCase { $input = new ArgvInput(array('cli.php', '-edev')); - // Control. $this->assertTrue($input->hasParameterOption(array('-e', ''))); - // No warning is thrown if https://github.com/symfony/symfony/pull/26156 is fixed + // No warning thrown $this->assertFalse($input->hasParameterOption(array('-m', ''))); - // Control. $this->assertEquals('dev', $input->getParameterOption(array('-e', ''))); - // No warning is thrown if https://github.com/symfony/symfony/pull/26156 is fixed + // No warning thrown $this->assertFalse($input->getParameterOption(array('-m', ''))); } From 43f942159d05eebdb88efb28a606ea3b07eaac68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Klva=C4=8D?= Date: Sun, 18 Feb 2018 14:02:56 +0100 Subject: [PATCH 06/12] Suppress warning from sapi_windows_vt100_support on stream other than STDIO --- src/Symfony/Component/Console/Output/StreamOutput.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Console/Output/StreamOutput.php b/src/Symfony/Component/Console/Output/StreamOutput.php index d32b1cfb54..d36e6f9560 100644 --- a/src/Symfony/Component/Console/Output/StreamOutput.php +++ b/src/Symfony/Component/Console/Output/StreamOutput.php @@ -90,7 +90,7 @@ class StreamOutput extends Output { if (DIRECTORY_SEPARATOR === '\\') { return - function_exists('sapi_windows_vt100_support') && sapi_windows_vt100_support($this->stream) + function_exists('sapi_windows_vt100_support') && @sapi_windows_vt100_support($this->stream) || '10.0.10586' === PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD || false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') From 0e4d26a5688f3b0292e12fdfa32815c37969159e Mon Sep 17 00:00:00 2001 From: Matthieu Napoli Date: Sun, 18 Feb 2018 18:35:19 +0100 Subject: [PATCH 07/12] Improve the documentation of --- src/Symfony/Component/Filesystem/Filesystem.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index 575ebaac4a..5c3b2a2d9c 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -431,13 +431,18 @@ class Filesystem /** * Mirrors a directory to another. * + * Copies files and directories from the origin directory into the target directory. By default: + * + * - existing files in the target directory will be overwritten, except if they are newer (see the `override` option) + * - files in the target directory that do not exist in the source directory will not be deleted (see the `delete` option) + * * @param string $originDir The origin directory * @param string $targetDir The target directory - * @param \Traversable $iterator A Traversable instance + * @param \Traversable $iterator Iterator that filters which files and directories to copy * @param array $options An array of boolean options * Valid options are: - * - $options['override'] Whether to override an existing file on copy or not (see copy()) - * - $options['copy_on_windows'] Whether to copy files instead of links on Windows (see symlink()) + * - $options['override'] If true, target files newer than origin files are overwritten (see copy(), defaults to false) + * - $options['copy_on_windows'] Whether to copy files instead of links on Windows (see symlink(), defaults to false) * - $options['delete'] Whether to delete files that are not in the source directory (defaults to false) * * @throws IOException When file type is unknown From 7490f0b0606255e1b60a13ef82f57017e585d3d4 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 19 Feb 2018 12:59:32 +0100 Subject: [PATCH 08/12] [HttpFoundation] Fix missing "throw" in JsonResponse --- src/Symfony/Component/HttpFoundation/JsonResponse.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Component/HttpFoundation/JsonResponse.php b/src/Symfony/Component/HttpFoundation/JsonResponse.php index 4ec2fa19a0..51852443c1 100644 --- a/src/Symfony/Component/HttpFoundation/JsonResponse.php +++ b/src/Symfony/Component/HttpFoundation/JsonResponse.php @@ -148,6 +148,7 @@ class JsonResponse extends Response if (\PHP_VERSION_ID < 50500 || !interface_exists('JsonSerializable', false)) { restore_error_handler(); } + throw $e; } catch (\Exception $e) { if (\PHP_VERSION_ID < 50500 || !interface_exists('JsonSerializable', false)) { restore_error_handler(); From 9ff86d61810a62fe69fd1671f8a8bb325d95468e Mon Sep 17 00:00:00 2001 From: Amrouche Hamza Date: Sat, 16 Dec 2017 16:19:00 +0100 Subject: [PATCH 09/12] [WebProfilerBundle] limit ajax request to 100 and remove the last one --- .../Resources/views/Profiler/base_js.html.twig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig index cde7a4c685..7aae3eef5b 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig @@ -108,6 +108,11 @@ var rows = document.createDocumentFragment(); if (requestStack.length) { + var nbOfAjaxRequest = tbodies.rows.count(); + if (nbOfAjaxRequest >= 100) { + tbodies.deleteRow(nbOfAjaxRequest - 1); + } + for (var i = 0; i < requestStack.length; i++) { var request = requestStack[i]; From 4055224373e321b63879873376257fe0efe07f26 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 19 Feb 2018 15:59:04 +0100 Subject: [PATCH 10/12] Clean calls to http_build_query() --- src/Symfony/Component/DomCrawler/Form.php | 2 +- src/Symfony/Component/HttpFoundation/Request.php | 2 +- src/Symfony/Component/HttpFoundation/Tests/RequestTest.php | 2 +- .../Component/Security/Http/Firewall/SwitchUserListener.php | 2 +- .../Component/Security/Http/Logout/LogoutUrlGenerator.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/DomCrawler/Form.php b/src/Symfony/Component/DomCrawler/Form.php index 54e5fc2b84..258be960a7 100644 --- a/src/Symfony/Component/DomCrawler/Form.php +++ b/src/Symfony/Component/DomCrawler/Form.php @@ -209,7 +209,7 @@ class Form extends Link implements \ArrayAccess parse_str($query, $currentParameters); } - $queryString = http_build_query(array_merge($currentParameters, $this->getValues()), null, '&'); + $queryString = http_build_query(array_merge($currentParameters, $this->getValues()), '', '&'); $pos = strpos($uri, '?'); $base = false === $pos ? $uri : substr($uri, 0, $pos); diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index fe7080ab86..ecdcdbc25a 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -522,7 +522,7 @@ class Request */ public function overrideGlobals() { - $this->server->set('QUERY_STRING', static::normalizeQueryString(http_build_query($this->query->all(), null, '&'))); + $this->server->set('QUERY_STRING', static::normalizeQueryString(http_build_query($this->query->all(), '', '&'))); $_GET = $this->query->all(); $_POST = $this->request->all(); diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index 96f87958ed..0c5451dfd6 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -2065,7 +2065,7 @@ class RequestContentProxy extends Request { public function getContent($asResource = false) { - return http_build_query(array('_method' => 'PUT', 'content' => 'mycontent')); + return http_build_query(array('_method' => 'PUT', 'content' => 'mycontent'), '', '&'); } } diff --git a/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php b/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php index f5113aa0c9..05531d8837 100644 --- a/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php @@ -89,7 +89,7 @@ class SwitchUserListener implements ListenerInterface } $request->query->remove($this->usernameParameter); - $request->server->set('QUERY_STRING', http_build_query($request->query->all())); + $request->server->set('QUERY_STRING', http_build_query($request->query->all(), '', '&')); $response = new RedirectResponse($request->getUri(), 302); diff --git a/src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php b/src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php index 1499d7e5ea..28ff315505 100644 --- a/src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php +++ b/src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php @@ -128,7 +128,7 @@ class LogoutUrlGenerator $url = UrlGeneratorInterface::ABSOLUTE_URL === $referenceType ? $request->getUriForPath($logoutPath) : $request->getBaseUrl().$logoutPath; if (!empty($parameters)) { - $url .= '?'.http_build_query($parameters); + $url .= '?'.http_build_query($parameters, '', '&'); } } else { if (!$this->router) { From 270147b04fbf54a688f4532c4d552d4d2041ee22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Mon, 19 Feb 2018 17:05:09 +0100 Subject: [PATCH 11/12] [PropertyInfo] ReflectionExtractor: give a chance to other extractors if no properties --- .../Extractor/ReflectionExtractor.php | 2 +- .../Extractors/ReflectionExtractorTest.php | 2 ++ .../Tests/Fixtures/NoProperties.php | 21 +++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 src/Symfony/Component/PropertyInfo/Tests/Fixtures/NoProperties.php diff --git a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php index 3ec1d8d6ea..b29d78d070 100644 --- a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php +++ b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php @@ -76,7 +76,7 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp $properties[$propertyName] = $propertyName; } - return array_values($properties); + return $properties ? array_values($properties) : null; } /** diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractors/ReflectionExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractors/ReflectionExtractorTest.php index cc2ecbe6f5..2828878ce6 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractors/ReflectionExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractors/ReflectionExtractorTest.php @@ -57,6 +57,8 @@ class ReflectionExtractorTest extends TestCase ), $this->extractor->getProperties('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy') ); + + $this->assertNull($this->extractor->getProperties('Symfony\Component\PropertyInfo\Tests\Fixtures\NoProperties')); } /** diff --git a/src/Symfony/Component/PropertyInfo/Tests/Fixtures/NoProperties.php b/src/Symfony/Component/PropertyInfo/Tests/Fixtures/NoProperties.php new file mode 100644 index 0000000000..177bbe4df0 --- /dev/null +++ b/src/Symfony/Component/PropertyInfo/Tests/Fixtures/NoProperties.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyInfo\Tests\Fixtures; + +/** + * @author Kévin Dunglas + */ +class NoProperties +{ +} From c338d85514a1fb84a616c8af259fdfb13c4fb54f Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 20 Feb 2018 13:42:18 +0100 Subject: [PATCH 12/12] Another PR template tweak --- .github/PULL_REQUEST_TEMPLATE.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index f52d3571ce..2d64894f41 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -3,15 +3,15 @@ | Branch? | master for features / 2.7 up to 4.0 for bug fixes | Bug fix? | yes/no | New feature? | yes/no -| BC breaks? | yes/no +| BC breaks? | no | Deprecations? | yes/no -| Tests pass? | yes/no -| Fixed tickets | #... +| Tests pass? | yes +| Fixed tickets | #... | License | MIT -| Doc PR | symfony/symfony-docs#... +| Doc PR | symfony/symfony-docs#...