From a5f05a04864f67f6738ef83d734039a7b85cc5ac Mon Sep 17 00:00:00 2001 From: "changmin.keum" Date: Thu, 15 Feb 2018 14:08:21 +0900 Subject: [PATCH 01/18] [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/18] [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/18] 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/18] 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/18] 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/18] 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/18] 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/18] [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 14c35ad13cc3f7ad59284beb208c89c61f72c290 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Mon, 19 Feb 2018 12:14:59 +0100 Subject: [PATCH 09/18] Add support for URL-like DSNs for the PdoSessionHandler This allows migrating away from the deprecated DbalSessionHandler when DBAL was used for its ability to be configured through a URL (which is what is provided on Heroku and some other PaaS). --- .../Storage/Handler/PdoSessionHandler.php | 100 +++++++++++++++++- .../Storage/Handler/PdoSessionHandlerTest.php | 35 ++++++ 2 files changed, 134 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php index 2e1692b6f0..c8737be18e 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php @@ -164,7 +164,7 @@ class PdoSessionHandler extends AbstractSessionHandler * * db_connection_options: An array of driver-specific connection options [default: array()] * * lock_mode: The strategy for locking, see constants [default: LOCK_TRANSACTIONAL] * - * @param \PDO|string|null $pdoOrDsn A \PDO instance or DSN string or null + * @param \PDO|string|null $pdoOrDsn A \PDO instance or DSN string or URL string or null * @param array $options An associative array of options * * @throws \InvalidArgumentException When PDO error mode is not PDO::ERRMODE_EXCEPTION @@ -178,6 +178,8 @@ class PdoSessionHandler extends AbstractSessionHandler $this->pdo = $pdoOrDsn; $this->driver = $this->pdo->getAttribute(\PDO::ATTR_DRIVER_NAME); + } elseif (is_string($pdoOrDsn) && false !== strpos($pdoOrDsn, '://')) { + $this->dsn = $this->buildDsnFromUrl($pdoOrDsn); } else { $this->dsn = $pdoOrDsn; } @@ -431,6 +433,102 @@ class PdoSessionHandler extends AbstractSessionHandler $this->driver = $this->pdo->getAttribute(\PDO::ATTR_DRIVER_NAME); } + /** + * Builds a PDO DSN from a URL-like connection string. + * + * @param string $dsnOrUrl + * + * @return string + * + * @todo implement missing support for oci DSN (which look totally different from other PDO ones) + */ + private function buildDsnFromUrl($dsnOrUrl) + { + // (pdo_)?sqlite3?:///... => (pdo_)?sqlite3?://localhost/... or else the URL will be invalid + $url = preg_replace('#^((?:pdo_)?sqlite3?):///#', '$1://localhost/', $dsnOrUrl); + + $params = parse_url($url); + + if (false === $params) { + return $dsnOrUrl; // If the URL is not valid, let's assume it might be a DSN already. + } + + $params = array_map('rawurldecode', $params); + + // Override the default username and password. Values passed through options will still win over these in the constructor. + if (isset($params['user'])) { + $this->username = $params['user']; + } + + if (isset($params['pass'])) { + $this->password = $params['pass']; + } + + if (!isset($params['scheme'])) { + throw new \InvalidArgumentException('URLs without scheme are not supported to configure the PdoSessionHandler'); + } + + $driverAliasMap = array( + 'mssql' => 'sqlsrv', + 'mysql2' => 'mysql', // Amazon RDS, for some weird reason + 'postgres' => 'pgsql', + 'postgresql' => 'pgsql', + 'sqlite3' => 'sqlite', + ); + + $driver = isset($driverAliasMap[$params['scheme']]) ? $driverAliasMap[$params['scheme']] : $params['scheme']; + + // Doctrine DBAL supports passing its internal pdo_* driver names directly too (allowing both dashes and underscores). This allows supporting the same here. + if (0 === strpos($driver, 'pdo_') || 0 === strpos($driver, 'pdo-')) { + $driver = substr($driver, 4); + } + + switch ($driver) { + case 'mysql': + case 'pgsql': + $dsn = $driver.':'; + + if (isset($params['host']) && '' !== $params['host']) { + $dsn .= 'host='.$params['host'].';'; + } + + if (isset($params['port']) && '' !== $params['port']) { + $dsn .= 'port='.$params['port'].';'; + } + + if (isset($params['path'])) { + $dbName = substr($params['path'], 1); // Remove the leading slash + $dsn .= 'dbname='.$dbName.';'; + } + + return $dsn; + + case 'sqlite': + return 'sqlite:'.substr($params['path'], 1); + + case 'sqlsrv': + $dsn = 'sqlsrv:server='; + + if (isset($params['host'])) { + $dsn .= $params['host']; + } + + if (isset($params['port']) && '' !== $params['port']) { + $dsn .= ','.$params['port']; + } + + if (isset($params['path'])) { + $dbName = substr($params['path'], 1); // Remove the leading slash + $dsn .= ';Database='.$dbName; + } + + return $dsn; + + default: + throw new \InvalidArgumentException(sprintf('The scheme "%s" is not supported by the PdoSessionHandler URL configuration. Pass a PDO DSN directly.', $params['scheme'])); + } + } + /** * Helper method to begin a transaction. * diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php index a0d7529f06..0a0e449051 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php @@ -324,6 +324,41 @@ class PdoSessionHandlerTest extends TestCase $this->assertInstanceOf('\PDO', $method->invoke($storage)); } + /** + * @dataProvider provideUrlDsnPairs + */ + public function testUrlDsn($url, $expectedDsn, $expectedUser = null, $expectedPassword = null) + { + $storage = new PdoSessionHandler($url); + + $this->assertAttributeEquals($expectedDsn, 'dsn', $storage); + + if (null !== $expectedUser) { + $this->assertAttributeEquals($expectedUser, 'username', $storage); + } + + if (null !== $expectedPassword) { + $this->assertAttributeEquals($expectedPassword, 'password', $storage); + } + } + + public function provideUrlDsnPairs() + { + yield array('mysql://localhost/test', 'mysql:host=localhost;dbname=test;'); + yield array('mysql://localhost:56/test', 'mysql:host=localhost;port=56;dbname=test;'); + yield array('mysql2://root:pwd@localhost/test', 'mysql:host=localhost;dbname=test;', 'root', 'pwd'); + yield array('postgres://localhost/test', 'pgsql:host=localhost;dbname=test;'); + yield array('postgresql://localhost:5634/test', 'pgsql:host=localhost;port=5634;dbname=test;'); + yield array('postgres://root:pwd@localhost/test', 'pgsql:host=localhost;dbname=test;', 'root', 'pwd'); + yield 'sqlite relative path' => array('sqlite://localhost/tmp/test', 'sqlite:tmp/test'); + yield 'sqlite absolute path' => array('sqlite://localhost//tmp/test', 'sqlite:/tmp/test'); + yield 'sqlite relative path without host' => array('sqlite:///tmp/test', 'sqlite:tmp/test'); + yield 'sqlite absolute path without host' => array('sqlite3:////tmp/test', 'sqlite:/tmp/test'); + yield array('sqlite://localhost/:memory:', 'sqlite::memory:'); + yield array('mssql://localhost/test', 'sqlsrv:server=localhost;Database=test'); + yield array('mssql://localhost:56/test', 'sqlsrv:server=localhost,56;Database=test'); + } + private function createStream($content) { $stream = tmpfile(); From 9ff86d61810a62fe69fd1671f8a8bb325d95468e Mon Sep 17 00:00:00 2001 From: Amrouche Hamza Date: Sat, 16 Dec 2017 16:19:00 +0100 Subject: [PATCH 10/18] [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 11/18] 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 12/18] [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 4be63f9f4ab3d9dbd6664cbe5e0a1b2f2203bba8 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 19 Feb 2018 17:55:06 +0100 Subject: [PATCH 13/18] fix CS --- .../Component/Form/Tests/AbstractBootstrap4LayoutTest.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Form/Tests/AbstractBootstrap4LayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractBootstrap4LayoutTest.php index 197f3ab8d6..89a95fca8d 100644 --- a/src/Symfony/Component/Form/Tests/AbstractBootstrap4LayoutTest.php +++ b/src/Symfony/Component/Form/Tests/AbstractBootstrap4LayoutTest.php @@ -547,7 +547,7 @@ abstract class AbstractBootstrap4LayoutTest extends AbstractBootstrap3LayoutTest ] /following-sibling::div [@class="form-check"] - [ + [ ./input[@type="radio"][@name="name"][@id="name_0"][@checked] /following-sibling::label [.="Choice&A"] @@ -959,8 +959,7 @@ abstract class AbstractBootstrap4LayoutTest extends AbstractBootstrap3LayoutTest ./span [@class="input-group-text"] [contains(.., "%")] - ] - + ] ] ' ); From 611ff59c3efa9b57b8e7af5d551f04c89c296507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Mon, 19 Feb 2018 16:01:42 +0100 Subject: [PATCH 14/18] [FrameworkBundle] Add missing XML config for circular_reference_handler. Add tests. --- .../Resources/config/schema/symfony-1.0.xsd | 1 + .../Tests/DependencyInjection/Fixtures/php/full.php | 1 + .../Tests/DependencyInjection/Fixtures/xml/full.xml | 2 +- .../Tests/DependencyInjection/Fixtures/yml/full.yml | 7 ++++--- .../Tests/DependencyInjection/FrameworkExtensionTest.php | 1 + 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd index cca86f8c61..f81b7d225c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd @@ -230,6 +230,7 @@ + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php index a97daeef1d..64de9309e8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php @@ -68,6 +68,7 @@ $container->loadFromExtension('framework', array( 'enabled' => true, 'enable_annotations' => true, 'name_converter' => 'serializer.name_converter.camel_case_to_snake_case', + 'circular_reference_handler' => 'my.circular.reference.handler', ), 'property_info' => true, 'ide' => 'file%%link%%format', diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml index 6920efebed..f083b9cb1a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml @@ -41,7 +41,7 @@ - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml index 3194a0fab2..f54c3e6eb1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml @@ -51,9 +51,10 @@ framework: debug: true file_cache_dir: '%kernel.cache_dir%/annotations' serializer: - enabled: true - enable_annotations: true - name_converter: serializer.name_converter.camel_case_to_snake_case + enabled: true + enable_annotations: true + name_converter: serializer.name_converter.camel_case_to_snake_case + circular_reference_handler: my.circular.reference.handler property_info: ~ ide: file%%link%%format request: diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 576b885560..c78354ed08 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -781,6 +781,7 @@ abstract class FrameworkExtensionTest extends TestCase $this->assertNull($container->getDefinition('serializer.mapping.class_metadata_factory')->getArgument(1)); $this->assertEquals(new Reference('serializer.name_converter.camel_case_to_snake_case'), $container->getDefinition('serializer.normalizer.object')->getArgument(1)); $this->assertEquals(new Reference('property_info', ContainerBuilder::IGNORE_ON_INVALID_REFERENCE), $container->getDefinition('serializer.normalizer.object')->getArgument(3)); + $this->assertEquals(array('setCircularReferenceHandler', array(new Reference('my.circular.reference.handler'))), $container->getDefinition('serializer.normalizer.object')->getMethodCalls()[0]); } public function testRegisterSerializerExtractor() From c338d85514a1fb84a616c8af259fdfb13c4fb54f Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 20 Feb 2018 13:42:18 +0100 Subject: [PATCH 15/18] 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#...