From ab2703be77840e4b0e3229481f675653e45cad04 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 5 Jul 2017 10:15:57 +0300 Subject: [PATCH 01/18] updated CHANGELOG for 2.7.31 --- CHANGELOG-2.7.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG-2.7.md b/CHANGELOG-2.7.md index cf90bc2e50..f5471bf653 100644 --- a/CHANGELOG-2.7.md +++ b/CHANGELOG-2.7.md @@ -7,6 +7,10 @@ in 2.7 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.7.0...v2.7.1 +* 2.7.31 (2017-07-05) + + * bug #23378 [FrameworkBundle] Do not remove files from assets dir (1ed) + * 2.7.30 (2017-07-03) * bug #23341 [DoctrineBridge][Security][Validator] do not validate empty values (xabbuh) From 3d332e53d46905eabc2d1daef8639da20ac56993 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 5 Jul 2017 10:16:08 +0300 Subject: [PATCH 02/18] update CONTRIBUTORS for 2.7.31 --- CONTRIBUTORS.md | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 0b695308c5..3e670f8d67 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -70,9 +70,9 @@ Symfony is the result of the work of many people who made the code better - Deni - Henrik Westphal (snc) - Dariusz Górecki (canni) + - Jáchym Toušek (enumag) - Titouan Galopin (tgalopin) - Douglas Greenshields (shieldo) - - Jáchym Toušek (enumag) - Konstantin Myakshin (koc) - Lee McDermott - Brandon Turner @@ -99,11 +99,12 @@ Symfony is the result of the work of many people who made the code better - Baptiste Clavié (talus) - Vladimir Reznichenko (kalessil) - marc.weistroff + - Yonel Ceruto González (yonelceruto) - lenar - Włodzimierz Gajda (gajdaw) - - Yonel Ceruto González (yonelceruto) - Alexander Schwenn (xelaris) - Jacob Dreesen (jdreesen) + - Tobias Nyholm (tobias) - Florian Voutzinos (florianv) - Colin Frei - Adrien Brault (adrienbrault) @@ -111,7 +112,6 @@ Symfony is the result of the work of many people who made the code better - Peter Kokot (maastermedia) - David Buchmann (dbu) - excelwebzone - - Tobias Nyholm (tobias) - Tomáš Votruba (tomas_votruba) - Fabien Pennequin (fabienpennequin) - Gordon Franke (gimler) @@ -133,12 +133,15 @@ Symfony is the result of the work of many people who made the code better - Guilherme Blanco (guilhermeblanco) - Pablo Godel (pgodel) - Jérémie Augustin (jaugustin) + - Dany Maillard (maidmaid) - Andréia Bohner (andreia) - Rafael Dohms (rdohms) - Arnaud Kleinpeter (nanocom) - jwdeitch + - David Maicher (dmaicher) - Mikael Pajunen - Joel Wurtz (brouznouf) + - Grégoire Paris (greg0ire) - Philipp Wahala (hifi) - Vyacheslav Pavlov - Richard van Laak (rvanlaak) @@ -147,11 +150,9 @@ Symfony is the result of the work of many people who made the code better - Thomas Rabaix (rande) - Rouven Weßling (realityking) - Teoh Han Hui (teohhanhui) - - David Maicher (dmaicher) - Jérôme Vasseur (jvasseur) - Clemens Tolboom - Helmer Aaviksoo - - Grégoire Paris (greg0ire) - Hiromi Hishida (77web) - Matthieu Ouellette-Vachon (maoueh) - Michał Pipa (michal.pipa) @@ -234,7 +235,6 @@ Symfony is the result of the work of many people who made the code better - Arjen Brouwer (arjenjb) - Katsuhiro OGAWA - Patrick McDougle (patrick-mcdougle) - - Dany Maillard (maidmaid) - Alif Rachmawadi - Kristen Gilden (kgilden) - Pierre-Yves LEBECQ (pylebecq) @@ -620,6 +620,7 @@ Symfony is the result of the work of many people who made the code better - develop - ReenExe - Mark Sonnabaum + - Maxime Veber (nek-) - Richard Quadling - jochenvdv - Arturas Smorgun (asarturas) @@ -642,6 +643,7 @@ Symfony is the result of the work of many people who made the code better - Trent Steel (trsteel88) - Yuen-Chi Lian - Besnik Br + - Jose Gonzalez - Dariusz Ruminski - Joshua Nye - Claudio Zizza @@ -1081,7 +1083,6 @@ Symfony is the result of the work of many people who made the code better - Max Summe - WedgeSama - Felds Liscia - - Maxime Veber (nek-) - Sullivan SENECHAL - Tadcka - Beth Binkovitz @@ -1092,12 +1093,12 @@ Symfony is the result of the work of many people who made the code better - Tomaz Ahlin - Marcus Stöhr (dafish) - Emmanuel Vella (emmanuel.vella) + - Adam Szaraniec (mimol) - Carsten Nielsen (phreaknerd) - Mathieu Rochette - Jay Severson - René Kerner - Nathaniel Catchpole - - Jose Gonzalez - Adrien Samson (adriensamson) - Samuel Gordalina (gordalina) - Max Romanovsky (maxromanovsky) @@ -1258,6 +1259,7 @@ Symfony is the result of the work of many people who made the code better - Aarón Nieves Fernández - Mike Meier - Kirill Saksin + - Julien Pauli - Koalabaerchen - michalmarcinkowski - Warwick @@ -1305,6 +1307,7 @@ Symfony is the result of the work of many people who made the code better - klemens - dened - Dmitry Korotovsky + - mcorteel - Michael van Tricht - Sam Ward - Walther Lalk @@ -1335,6 +1338,7 @@ Symfony is the result of the work of many people who made the code better - Jan Marek (janmarek) - Mark de Haan (markdehaan) - Dan Patrick (mdpatrick) + - Pedro Magalhães (pmmaga) - Rares Vlaseanu (raresvla) - tante kinast (tante) - Vincent LEFORT (vlefort) @@ -1542,6 +1546,7 @@ Symfony is the result of the work of many people who made the code better - Abdulkadir N. A. - Yevgen Kovalienia - Lebnik + - Shude - Ondřej Führer - Sema - Elan Ruusamäe From beee4332a1ead444d4d04964e3e36fcddc03a3f1 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 5 Jul 2017 10:16:12 +0300 Subject: [PATCH 03/18] updated VERSION for 2.7.31 --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index fc6c87b9e0..6233186a48 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -58,12 +58,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.7.31-DEV'; + const VERSION = '2.7.31'; const VERSION_ID = 20731; const MAJOR_VERSION = 2; const MINOR_VERSION = 7; const RELEASE_VERSION = 31; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '05/2018'; const END_OF_LIFE = '05/2019'; From 7b442211dc8ad4df4a8d65d2be0ab006082a1a6b Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 5 Jul 2017 10:25:28 +0300 Subject: [PATCH 04/18] [Filesystem] Dont copy perms when origin is remote --- src/Symfony/Component/Filesystem/Filesystem.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index e60d469073..bc2e3dcc2d 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -37,7 +37,8 @@ class Filesystem */ public function copy($originFile, $targetFile, $overwriteNewerFiles = false) { - if (stream_is_local($originFile) && !is_file($originFile)) { + $originIsLocal = stream_is_local($originFile) || 0 === stripos($originFile, 'file://'); + if ($originIsLocal && !is_file($originFile)) { throw new FileNotFoundException(sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile); } @@ -68,11 +69,13 @@ class Filesystem throw new IOException(sprintf('Failed to copy "%s" to "%s".', $originFile, $targetFile), 0, null, $originFile); } - // Like `cp`, preserve executable permission bits - @chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111)); + if ($originIsLocal) { + // Like `cp`, preserve executable permission bits + @chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111)); - if (stream_is_local($originFile) && $bytesCopied !== ($bytesOrigin = filesize($originFile))) { - throw new IOException(sprintf('Failed to copy the whole content of "%s" to "%s" (%g of %g bytes copied).', $originFile, $targetFile, $bytesCopied, $bytesOrigin), 0, null, $originFile); + if ($bytesCopied !== $bytesOrigin = filesize($originFile)) { + throw new IOException(sprintf('Failed to copy the whole content of "%s" to "%s" (%g of %g bytes copied).', $originFile, $targetFile, $bytesCopied, $bytesOrigin), 0, null, $originFile); + } } } } From 39fc4ddec79a56dd44e129b7b165b9e2cfe9cb79 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 5 Jul 2017 11:52:01 +0300 Subject: [PATCH 05/18] bumped Symfony version to 2.7.32 --- src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 6233186a48..00d9c82365 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -58,12 +58,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.7.31'; - const VERSION_ID = 20731; + const VERSION = '2.7.32-DEV'; + const VERSION_ID = 20732; const MAJOR_VERSION = 2; const MINOR_VERSION = 7; - const RELEASE_VERSION = 31; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 32; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '05/2018'; const END_OF_LIFE = '05/2019'; From 09797de7578b9ff71ffeeda52918397fd871e7cc Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 5 Jul 2017 11:52:53 +0300 Subject: [PATCH 06/18] updated CHANGELOG for 2.8.24 --- CHANGELOG-2.8.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG-2.8.md b/CHANGELOG-2.8.md index ce55fb1631..661863ef7c 100644 --- a/CHANGELOG-2.8.md +++ b/CHANGELOG-2.8.md @@ -7,6 +7,10 @@ in 2.8 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.8.0...v2.8.1 +* 2.8.24 (2017-07-05) + + * bug #23378 [FrameworkBundle] Do not remove files from assets dir (1ed) + * 2.8.23 (2017-07-04) * bug #23341 [DoctrineBridge][Security][Validator] do not validate empty values (xabbuh) From bf1be0e08f4e3e2d0f76b66c12de20fd793e1060 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 5 Jul 2017 11:52:59 +0300 Subject: [PATCH 07/18] updated VERSION for 2.8.24 --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 67a02337b5..056d2e2aad 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -59,12 +59,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.8.24-DEV'; + const VERSION = '2.8.24'; const VERSION_ID = 20824; const MAJOR_VERSION = 2; const MINOR_VERSION = 8; const RELEASE_VERSION = 24; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '11/2018'; const END_OF_LIFE = '11/2019'; From 15df829a83ffd22c7bf3aa45b4630dfb16d1518c Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 5 Jul 2017 12:39:23 +0300 Subject: [PATCH 08/18] bumped Symfony version to 2.8.25 --- src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 056d2e2aad..150fc17cf1 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -59,12 +59,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.8.24'; - const VERSION_ID = 20824; + const VERSION = '2.8.25-DEV'; + const VERSION_ID = 20825; const MAJOR_VERSION = 2; const MINOR_VERSION = 8; - const RELEASE_VERSION = 24; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 25; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '11/2018'; const END_OF_LIFE = '11/2019'; From 89ad27d54464bcf3c043c72a0629d3a0e90e30d1 Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Thu, 22 Jun 2017 11:09:30 +0200 Subject: [PATCH 09/18] Fixed absolute url generation for query strings and hash urls --- .../Twig/Extension/HttpFoundationExtension.php | 13 +++++++++++++ .../Tests/Extension/HttpFoundationExtensionTest.php | 9 +++++++++ 2 files changed, 22 insertions(+) diff --git a/src/Symfony/Bridge/Twig/Extension/HttpFoundationExtension.php b/src/Symfony/Bridge/Twig/Extension/HttpFoundationExtension.php index 69d6d326f4..6e1f5753d2 100644 --- a/src/Symfony/Bridge/Twig/Extension/HttpFoundationExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/HttpFoundationExtension.php @@ -70,6 +70,13 @@ class HttpFoundationExtension extends \Twig_Extension $port = ':'.$this->requestContext->getHttpsPort(); } + if ('#' === $path[0]) { + $queryString = $this->requestContext->getQueryString(); + $path = $this->requestContext->getPathInfo().($queryString ? '?'.$queryString : '').$path; + } elseif ('?' === $path[0]) { + $path = $this->requestContext->getPathInfo().$path; + } + if ('/' !== $path[0]) { $path = rtrim($this->requestContext->getBaseUrl(), '/').'/'.$path; } @@ -80,6 +87,12 @@ class HttpFoundationExtension extends \Twig_Extension return $path; } + if ('#' === $path[0]) { + $path = $request->getRequestUri().$path; + } elseif ('?' === $path[0]) { + $path = $request->getPathInfo().$path; + } + if (!$path || '/' !== $path[0]) { $prefix = $request->getPathInfo(); $last = strlen($prefix) - 1; diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/HttpFoundationExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/HttpFoundationExtensionTest.php index 339d43d7c6..3d9e9e6abe 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/HttpFoundationExtensionTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/HttpFoundationExtensionTest.php @@ -41,6 +41,15 @@ class HttpFoundationExtensionTest extends \PHPUnit_Framework_TestCase array('http://example.com/baz', 'http://example.com/baz', '/'), array('https://example.com/baz', 'https://example.com/baz', '/'), array('//example.com/baz', '//example.com/baz', '/'), + + array('http://localhost/foo/bar?baz', '?baz', '/foo/bar'), + array('http://localhost/foo/bar?baz=1', '?baz=1', '/foo/bar?foo=1'), + array('http://localhost/foo/baz?baz=1', 'baz?baz=1', '/foo/bar?foo=1'), + + array('http://localhost/foo/bar#baz', '#baz', '/foo/bar'), + array('http://localhost/foo/bar?0#baz', '#baz', '/foo/bar?0'), + array('http://localhost/foo/bar?baz=1#baz', '?baz=1#baz', '/foo/bar?foo=1'), + array('http://localhost/foo/baz?baz=1#baz', 'baz?baz=1#baz', '/foo/bar?foo=1'), ); } From ec3cc84656313179fd16e162174aa99ee3f28a8b Mon Sep 17 00:00:00 2001 From: Maxime Veber Date: Fri, 31 Mar 2017 11:20:07 +0200 Subject: [PATCH 10/18] Fix phpdoc for serializer normalizers exceptions The normalizers throw exceptions. They need to be documented for DX in the normalizer/denormalizer interfaces. [Serializer] fit Symfony phpdoc standard It also adds meaning of each exception throw. Fix grammary in phpdoc --- .../Normalizer/AbstractObjectNormalizer.php | 3 --- .../Serializer/Normalizer/ArrayDenormalizer.php | 2 -- .../Serializer/Normalizer/DataUriNormalizer.php | 3 --- .../Normalizer/DenormalizerInterface.php | 14 ++++++++++++++ .../Serializer/Normalizer/NormalizerInterface.php | 9 +++++++++ 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php index 2b3433c567..188b79ade8 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php @@ -13,7 +13,6 @@ namespace Symfony\Component\Serializer\Normalizer; use Symfony\Component\PropertyAccess\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Encoder\JsonEncoder; -use Symfony\Component\Serializer\Exception\CircularReferenceException; use Symfony\Component\Serializer\Exception\LogicException; use Symfony\Component\Serializer\Exception\UnexpectedValueException; use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface; @@ -52,8 +51,6 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer /** * {@inheritdoc} - * - * @throws CircularReferenceException */ public function normalize($object, $format = null, array $context = array()) { diff --git a/src/Symfony/Component/Serializer/Normalizer/ArrayDenormalizer.php b/src/Symfony/Component/Serializer/Normalizer/ArrayDenormalizer.php index 7d3d87c510..9217d51a95 100644 --- a/src/Symfony/Component/Serializer/Normalizer/ArrayDenormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/ArrayDenormalizer.php @@ -31,8 +31,6 @@ class ArrayDenormalizer implements DenormalizerInterface, SerializerAwareInterfa /** * {@inheritdoc} - * - * @throws UnexpectedValueException */ public function denormalize($data, $class, $format = null, array $context = array()) { diff --git a/src/Symfony/Component/Serializer/Normalizer/DataUriNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/DataUriNormalizer.php index 988a491b7c..9e5af130d0 100644 --- a/src/Symfony/Component/Serializer/Normalizer/DataUriNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/DataUriNormalizer.php @@ -79,9 +79,6 @@ class DataUriNormalizer implements NormalizerInterface, DenormalizerInterface * Regex adapted from Brian Grinstead code. * * @see https://gist.github.com/bgrins/6194623 - * - * @throws InvalidArgumentException - * @throws UnexpectedValueException */ public function denormalize($data, $class, $format = null, array $context = array()) { diff --git a/src/Symfony/Component/Serializer/Normalizer/DenormalizerInterface.php b/src/Symfony/Component/Serializer/Normalizer/DenormalizerInterface.php index 23df4829a8..2b3b206287 100644 --- a/src/Symfony/Component/Serializer/Normalizer/DenormalizerInterface.php +++ b/src/Symfony/Component/Serializer/Normalizer/DenormalizerInterface.php @@ -11,6 +11,13 @@ namespace Symfony\Component\Serializer\Normalizer; +use Symfony\Component\Serializer\Exception\BadMethodCallException; +use Symfony\Component\Serializer\Exception\ExtraAttributesException; +use Symfony\Component\Serializer\Exception\InvalidArgumentException; +use Symfony\Component\Serializer\Exception\LogicException; +use Symfony\Component\Serializer\Exception\RuntimeException; +use Symfony\Component\Serializer\Exception\UnexpectedValueException; + /** * Defines the interface of denormalizers. * @@ -27,6 +34,13 @@ interface DenormalizerInterface * @param array $context options available to the denormalizer * * @return object + * + * @throws BadMethodCallException Occurs when the normalizer is not called in an expected context + * @throws InvalidArgumentException Occurs when the arguments are not coherent or not supported + * @throws UnexpectedValueException Occurs when the item cannot be hydrated with the given data + * @throws ExtraAttributesException Occurs when the item doesn't have attribute to receive given data + * @throws LogicException Occurs when the normalizer is not supposed to denormalize + * @throws RuntimeException Occurs if the class cannot be instantiated */ public function denormalize($data, $class, $format = null, array $context = array()); diff --git a/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php b/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php index f7007840da..2779053f74 100644 --- a/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php +++ b/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php @@ -11,6 +11,10 @@ namespace Symfony\Component\Serializer\Normalizer; +use Symfony\Component\Serializer\Exception\CircularReferenceException; +use Symfony\Component\Serializer\Exception\InvalidArgumentException; +use Symfony\Component\Serializer\Exception\LogicException; + /** * Defines the interface of normalizers. * @@ -26,6 +30,11 @@ interface NormalizerInterface * @param array $context Context options for the normalizer * * @return array|scalar + * + * @throws InvalidArgumentException Occurs when the object given is not an attempted type for the normalizer + * @throws CircularReferenceException Occurs when the normalizer detects a circular reference when no circular + * reference handler can fix it + * @throws LogicException Occurs when the normalizer is not called in an expected context */ public function normalize($object, $format = null, array $context = array()); From 032e654acbe13e256d8ce6454200b8e5289c0bde Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Thu, 6 Jul 2017 09:10:09 +0200 Subject: [PATCH 11/18] require the XML PHP extension --- composer.json | 1 + src/Symfony/Bundle/DebugBundle/composer.json | 1 + src/Symfony/Bundle/SecurityBundle/composer.json | 1 + 3 files changed, 3 insertions(+) diff --git a/composer.json b/composer.json index 1770bc4f30..a7f3bbf907 100644 --- a/composer.json +++ b/composer.json @@ -17,6 +17,7 @@ ], "require": { "php": ">=5.3.9", + "ext-xml": "*", "doctrine/common": "~2.4", "paragonie/random_compat": "~1.0", "symfony/polyfill-apcu": "~1.1", diff --git a/src/Symfony/Bundle/DebugBundle/composer.json b/src/Symfony/Bundle/DebugBundle/composer.json index d4cba7fc24..3fde4a6724 100644 --- a/src/Symfony/Bundle/DebugBundle/composer.json +++ b/src/Symfony/Bundle/DebugBundle/composer.json @@ -17,6 +17,7 @@ ], "require": { "php": ">=5.3.9", + "ext-xml": "*", "symfony/http-kernel": "~2.6", "symfony/twig-bridge": "~2.6", "symfony/var-dumper": "~2.6" diff --git a/src/Symfony/Bundle/SecurityBundle/composer.json b/src/Symfony/Bundle/SecurityBundle/composer.json index 3da10d429d..6d6073f7f0 100644 --- a/src/Symfony/Bundle/SecurityBundle/composer.json +++ b/src/Symfony/Bundle/SecurityBundle/composer.json @@ -17,6 +17,7 @@ ], "require": { "php": ">=5.3.9", + "ext-xml": "*", "symfony/security": "~2.7", "symfony/security-acl": "~2.7", "symfony/http-kernel": "~2.7" From 8a197958cbd300091fce9dbe67852312341bb069 Mon Sep 17 00:00:00 2001 From: Roland Franssen Date: Sat, 8 Jul 2017 21:11:54 +0200 Subject: [PATCH 12/18] [WebProfilerBundle] Cleanup profiler leftover --- .../Controller/ProfilerController.php | 28 ------------------- .../Resources/config/routing/profiler.xml | 4 --- .../Resources/views/Profiler/info.html.twig | 15 ---------- 3 files changed, 47 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php index 37f47df6a6..7ebd04b574 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php @@ -128,34 +128,6 @@ class ProfilerController )), 200, array('Content-Type' => 'text/html')); } - /** - * Displays information page. - * - * @param Request $request The current HTTP Request - * @param string $about The about message - * - * @return Response A Response instance - * - * @throws NotFoundHttpException - */ - public function infoAction(Request $request, $about) - { - if (null === $this->profiler) { - throw new NotFoundHttpException('The profiler must be enabled.'); - } - - $this->profiler->disable(); - - if (null !== $this->cspHandler) { - $this->cspHandler->disableCsp(); - } - - return new Response($this->twig->render('@WebProfiler/Profiler/info.html.twig', array( - 'about' => $about, - 'request' => $request, - )), 200, array('Content-Type' => 'text/html')); - } - /** * Renders the Web Debug Toolbar. * diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/config/routing/profiler.xml b/src/Symfony/Bundle/WebProfilerBundle/Resources/config/routing/profiler.xml index 1a4bd39c62..0be717b19d 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/config/routing/profiler.xml +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/config/routing/profiler.xml @@ -16,10 +16,6 @@ web_profiler.controller.profiler:searchBarAction - - web_profiler.controller.profiler:infoAction - - web_profiler.controller.profiler:phpinfoAction diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/info.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/info.html.twig index ef381fe4a7..0227532e12 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/info.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/info.html.twig @@ -1,25 +1,10 @@ {% extends '@WebProfiler/Profiler/layout.html.twig' %} {% set messages = { - 'purge' : { - status: 'success', - title: 'The profiler database was purged successfully', - message: 'Now you need to browse some pages with the Symfony Profiler enabled to collect data.' - }, 'no_token' : { status: 'error', title: (token|default('') == 'latest') ? 'There are no profiles' : 'Token not found', message: (token|default('') == 'latest') ? 'No profiles found in the database.' : 'Token "' ~ token|default('') ~ '" was not found in the database.' - }, - 'upload_error' : { - status: 'error', - title: 'A problem occurred when uploading the data', - message: 'No file given or the file was not uploaded successfully.' - }, - 'already_exists' : { - status: 'error', - title: 'A problem occurred when uploading the data', - message: 'The token already exists in the database.' } } %} From b033e79211663be8e300b4f0635b25722266a798 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 9 Jul 2017 12:27:07 +0200 Subject: [PATCH 13/18] =?UTF-8?q?[FrameworkBundle]=C2=A0fix=20changelog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `framework.serializer.cache` option was also deprecated in Symfony 3.1. This was documented in the upgrade file, but was not reflected in the bundle's changelog. --- src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md index efee66b41c..c1eb01d328 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md +++ b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md @@ -21,7 +21,8 @@ CHANGELOG * Deprecated using core form types without dependencies as services * Added `Symfony\Component\HttpHernel\DataCollector\RequestDataCollector::onKernelResponse()` * Added `Symfony\Bundle\FrameworkBundle\DataCollector\RequestDataCollector` - * Deprecated service `serializer.mapping.cache.apc` (use `serializer.mapping.cache.doctrine.apc` instead) + * The `framework.serializer.cache` option and the service `serializer.mapping.cache.apc` have been + deprecated. APCu should now be automatically used when available. 3.0.0 ----- From 5dbee5b5bde64e8097da9037d3ac9f267024f320 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 9 Jul 2017 14:41:10 +0200 Subject: [PATCH 14/18] [HttpKernel] fix DumpDataCollector tests --- .../HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php index 9a306e533e..e642e3c337 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php @@ -50,7 +50,7 @@ class DumpDataCollectorTest extends TestCase ); $this->assertEquals($xDump, $dump); - $this->assertStringMatchesFormat('a:3:{i:0;a:5:{s:4:"data";O:39:"Symfony\Component\VarDumper\Cloner\Data":%a', $collector->serialize()); + $this->assertStringMatchesFormat('a:3:{i:0;a:5:{s:4:"data";%c:39:"Symfony\Component\VarDumper\Cloner\Data":%a', $collector->serialize()); $this->assertSame(0, $collector->getDumpsCount()); $this->assertSame('a:2:{i:0;b:0;i:1;s:5:"UTF-8";}', $collector->serialize()); } From 5a3a24b0ac74ad36ca380fad02ef6aed11909a65 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 9 Jul 2017 15:51:00 +0200 Subject: [PATCH 15/18] allow to configure custom formats in XML configs --- .../Resources/config/schema/twig-1.0.xsd | 15 ++++++++++++++ .../Fixtures/php/formats.php | 14 +++++++++++++ .../Fixtures/xml/formats.xml | 12 +++++++++++ .../Fixtures/yml/formats.yml | 9 +++++++++ .../DependencyInjection/TwigExtensionTest.php | 20 +++++++++++++++++++ 5 files changed, 70 insertions(+) create mode 100644 src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/formats.php create mode 100644 src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/xml/formats.xml create mode 100644 src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/yml/formats.yml diff --git a/src/Symfony/Bundle/TwigBundle/Resources/config/schema/twig-1.0.xsd b/src/Symfony/Bundle/TwigBundle/Resources/config/schema/twig-1.0.xsd index 474b6c9721..70b6de5c38 100644 --- a/src/Symfony/Bundle/TwigBundle/Resources/config/schema/twig-1.0.xsd +++ b/src/Symfony/Bundle/TwigBundle/Resources/config/schema/twig-1.0.xsd @@ -9,6 +9,9 @@ + + + @@ -28,6 +31,18 @@ + + + + + + + + + + + + diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/formats.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/formats.php new file mode 100644 index 0000000000..630a9a9edc --- /dev/null +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/formats.php @@ -0,0 +1,14 @@ +loadFromExtension('twig', array( + 'date' => array( + 'format' => 'Y-m-d', + 'interval_format' => '%d', + 'timezone' => 'Europe/Berlin', + ), + 'number_format' => array( + 'decimals' => 2, + 'decimal_point' => ',', + 'thousands_separator' => '.', + ), +)); diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/xml/formats.xml b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/xml/formats.xml new file mode 100644 index 0000000000..1ab39e4922 --- /dev/null +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/xml/formats.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/yml/formats.yml b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/yml/formats.yml new file mode 100644 index 0000000000..290921630f --- /dev/null +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/yml/formats.yml @@ -0,0 +1,9 @@ +twig: + date: + format: Y-m-d + interval_format: '%d' + timezone: Europe/Berlin + number_format: + decimals: 2 + decimal_point: ',' + thousands_separator: . diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php index f5809cc045..f385ec04fd 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php @@ -150,6 +150,26 @@ class TwigExtensionTest extends TestCase $this->assertEquals('name', $options['autoescape']); } + /** + * @dataProvider getFormats + */ + public function testLoadCustomDateFormats($fileFormat) + { + $container = $this->createContainer(); + $container->registerExtension(new TwigExtension()); + $this->loadFromFile($container, 'formats', $fileFormat); + $this->compileContainer($container); + + $environmentConfigurator = $container->getDefinition('twig.configurator.environment'); + + $this->assertSame('Y-m-d', $environmentConfigurator->getArgument(0)); + $this->assertSame('%d', $environmentConfigurator->getArgument(1)); + $this->assertSame('Europe/Berlin', $environmentConfigurator->getArgument(2)); + $this->assertSame(2, $environmentConfigurator->getArgument(3)); + $this->assertSame(',', $environmentConfigurator->getArgument(4)); + $this->assertSame('.', $environmentConfigurator->getArgument(5)); + } + public function testGlobalsWithDifferentTypesAndValues() { $globals = array( From 64d196adaee02cfa747ac1c7870df295b4db1d48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Fri, 7 Jul 2017 12:05:26 +0200 Subject: [PATCH 16/18] [Cache] Added test for ApcuAdapter when using in CLI --- .../Cache/Tests/Adapter/ApcuAdapterTest.php | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Cache/Tests/Adapter/ApcuAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/ApcuAdapterTest.php index 50206bb278..8c6eacf4bb 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/ApcuAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/ApcuAdapterTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Adapter; +use Psr\Log\NullLogger; use Symfony\Component\Cache\Adapter\ApcuAdapter; class ApcuAdapterTest extends AdapterTestCase @@ -23,9 +24,14 @@ class ApcuAdapterTest extends AdapterTestCase public function createCachePool($defaultLifetime = 0) { - if (!function_exists('apcu_fetch') || !ini_get('apc.enabled') || ('cli' === PHP_SAPI && !ini_get('apc.enable_cli'))) { + if (!function_exists('apcu_fetch') || !ini_get('apc.enabled')) { $this->markTestSkipped('APCu extension is required.'); } + if ('cli' === PHP_SAPI && !ini_get('apc.enable_cli')) { + if ('testWithCliSapi' !== $this->getName()) { + $this->markTestSkipped('APCu extension is required.'); + } + } if ('\\' === DIRECTORY_SEPARATOR) { $this->markTestSkipped('Fails transiently on Windows.'); } @@ -70,4 +76,24 @@ class ApcuAdapterTest extends AdapterTestCase $this->assertFalse($item->isHit()); $this->assertNull($item->get()); } + + public function testWithCliSapi() + { + try { + // disable PHPUnit error handler to mimic a production environment + $isCalled = false; + set_error_handler(function () use (&$isCalled) { + $isCalled = true; + }); + $pool = new ApcuAdapter(str_replace('\\', '.', __CLASS__)); + $pool->setLogger(new NullLogger()); + + $item = $pool->getItem('foo'); + $item->isHit(); + $pool->save($item->set('bar')); + $this->assertFalse($isCalled); + } finally { + restore_error_handler(); + } + } } From 9380614de9a7f7ef226e94d22611153070b14e83 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 10 Jul 2017 19:31:39 +0200 Subject: [PATCH 17/18] do not wire namespaces for the ArrayAdapter --- .../Compiler/CachePoolPass.php | 3 ++- .../Compiler/CachePoolPassTest.php | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolPass.php index db1430eb49..eda6f936bf 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolPass.php @@ -11,6 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler; +use Symfony\Component\Cache\Adapter\ArrayAdapter; use Symfony\Component\Cache\Adapter\RedisAdapter; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -70,7 +71,7 @@ class CachePoolPass implements CompilerPassInterface } $i = 0; foreach ($attributes as $attr) { - if (isset($tags[0][$attr])) { + if (isset($tags[0][$attr]) && ('namespace' !== $attr || ArrayAdapter::class !== $adapter->getClass())) { $pool->replaceArgument($i++, $tags[0][$attr]); } unset($tags[0][$attr]); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPassTest.php index 6fe6b30eb3..e9b9bbc778 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPassTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPassTest.php @@ -13,6 +13,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler; use PHPUnit\Framework\TestCase; use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\CachePoolPass; +use Symfony\Component\Cache\Adapter\ArrayAdapter; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\DefinitionDecorator; @@ -49,6 +50,24 @@ class CachePoolPassTest extends TestCase $this->assertSame('D07rhFx97S', $cachePool->getArgument(0)); } + public function testNamespaceArgumentIsNotReplacedIfArrayAdapterIsUsed() + { + $container = new ContainerBuilder(); + $container->setParameter('kernel.environment', 'prod'); + $container->setParameter('kernel.name', 'app'); + $container->setParameter('kernel.root_dir', 'foo'); + + $container->register('cache.adapter.array', ArrayAdapter::class)->addArgument(0); + + $cachePool = new DefinitionDecorator('cache.adapter.array'); + $cachePool->addTag('cache.pool'); + $container->setDefinition('app.cache_pool', $cachePool); + + $this->cachePoolPass->process($container); + + $this->assertCount(0, $container->getDefinition('app.cache_pool')->getArguments()); + } + public function testArgsAreReplaced() { $container = new ContainerBuilder(); From ca3ff88361cc64ca6f23a02418c3331014348cff Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Sun, 9 Jul 2017 19:50:49 +0200 Subject: [PATCH 18/18] Don't display the Symfony debug toolbar when printing the page --- .../Resources/views/Profiler/toolbar.css.twig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig index c148954f5a..16a3310d77 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig @@ -527,3 +527,10 @@ padding: 5px 0; margin-right: 10px; } + +/***** Media query print: Do not print the Toolbar. *****/ +@media print { + .sf-toolbar { + display: none; + } +}