diff --git a/CHANGELOG-3.2.md b/CHANGELOG-3.2.md index f0c3713038aff..71a26930ea92b 100644 --- a/CHANGELOG-3.2.md +++ b/CHANGELOG-3.2.md @@ -7,6 +7,12 @@ in 3.2 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/v3.2.0...v3.2.1 +* 3.2.6 (2017-03-10) + + * bug #21930 [Cache] Cached files rely on umask (4rthem) + * bug #21946 Use PHPUnit 5.4 instead of 5.3 (j0k3r) + * bug #21936 [PropertyAccess] Use ArrayAdapter in debug mode (chalasr) + * 3.2.5 (2017-03-09) * bug #21923 [travis] Test with hhvm 3.18 (nicolas-grekas) diff --git a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit index 331ff8a02c686..17e971bb432d4 100755 --- a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit +++ b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit @@ -16,7 +16,7 @@ error_reporting(-1); // PHPUnit 4.8 does not support PHP 7, while 5.1 requires PHP 5.6+ -$PHPUNIT_VERSION = PHP_VERSION_ID >= 50600 ? getenv('SYMFONY_PHPUNIT_VERSION') ?: '5.3' : '4.8'; +$PHPUNIT_VERSION = PHP_VERSION_ID >= 50600 ? getenv('SYMFONY_PHPUNIT_VERSION') ?: '5.4' : '4.8'; $oldPwd = getcwd(); $PHPUNIT_DIR = getenv('SYMFONY_PHPUNIT_DIR') ?: (__DIR__.'/.phpunit'); $PHP = defined('PHP_BINARY') ? PHP_BINARY : 'php'; diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 60cbd4fd48eea..601e120885fd9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -14,6 +14,7 @@ use Doctrine\Common\Annotations\Reader; use Symfony\Bridge\Monolog\Processor\DebugProcessor; use Symfony\Component\Cache\Adapter\AdapterInterface; +use Symfony\Component\Cache\Adapter\ArrayAdapter; use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -1256,10 +1257,16 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con if (method_exists(PropertyAccessor::class, 'createCache')) { $propertyAccessDefinition = $container->register('cache.property_access', AdapterInterface::class); $propertyAccessDefinition->setPublic(false); - $propertyAccessDefinition->setFactory(array(PropertyAccessor::class, 'createCache')); - $propertyAccessDefinition->setArguments(array(null, null, $version, new Reference('logger', ContainerInterface::IGNORE_ON_INVALID_REFERENCE))); - $propertyAccessDefinition->addTag('cache.pool', array('clearer' => 'cache.default_clearer')); - $propertyAccessDefinition->addTag('monolog.logger', array('channel' => 'cache')); + + if (!$container->getParameter('kernel.debug')) { + $propertyAccessDefinition->setFactory(array(PropertyAccessor::class, 'createCache')); + $propertyAccessDefinition->setArguments(array(null, null, $version, new Reference('logger', ContainerInterface::IGNORE_ON_INVALID_REFERENCE))); + $propertyAccessDefinition->addTag('cache.pool', array('clearer' => 'cache.default_clearer')); + $propertyAccessDefinition->addTag('monolog.logger', array('channel' => 'cache')); + } else { + $propertyAccessDefinition->setClass(ArrayAdapter::class); + $propertyAccessDefinition->setArguments(array(0, false)); + } } $this->addClassesToCompile(array( diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 71b5fada8f0f4..7adf4035ecbc7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -14,7 +14,9 @@ use Symfony\Bundle\FrameworkBundle\Tests\TestCase; use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddAnnotationsCachedReaderPass; use Symfony\Bundle\FrameworkBundle\DependencyInjection\FrameworkExtension; +use Symfony\Component\Cache\Adapter\AdapterInterface; use Symfony\Component\Cache\Adapter\ApcuAdapter; +use Symfony\Component\Cache\Adapter\ArrayAdapter; use Symfony\Component\Cache\Adapter\ChainAdapter; use Symfony\Component\Cache\Adapter\DoctrineAdapter; use Symfony\Component\Cache\Adapter\FilesystemAdapter; @@ -25,6 +27,7 @@ use Symfony\Component\DependencyInjection\Loader\ClosureLoader; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\PropertyAccess\PropertyAccessor; use Symfony\Component\Serializer\Mapping\Factory\CacheClassMetadataFactory; use Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader; use Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader; @@ -67,6 +70,32 @@ public function testPropertyAccessWithOverriddenValues() $this->assertTrue($def->getArgument(1)); } + public function testPropertyAccessCache() + { + $container = $this->createContainerFromFile('property_accessor'); + + if (!method_exists(PropertyAccessor::class, 'createCache')) { + return $this->assertFalse($container->hasDefinition('cache.property_access')); + } + + $cache = $container->getDefinition('cache.property_access'); + $this->assertSame(array(PropertyAccessor::class, 'createCache'), $cache->getFactory(), 'PropertyAccessor::createCache() should be used in non-debug mode'); + $this->assertSame(AdapterInterface::class, $cache->getClass()); + } + + public function testPropertyAccessCacheWithDebug() + { + $container = $this->createContainerFromFile('property_accessor', array('kernel.debug' => true)); + + if (!method_exists(PropertyAccessor::class, 'createCache')) { + return $this->assertFalse($container->hasDefinition('cache.property_access')); + } + + $cache = $container->getDefinition('cache.property_access'); + $this->assertNull($cache->getFactory()); + $this->assertSame(ArrayAdapter::class, $cache->getClass(), 'ArrayAdapter should be used in debug mode'); + } + /** * @expectedException \LogicException * @expectedExceptionMessage CSRF protection needs sessions to be enabled. diff --git a/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php b/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php index c272ad0a4ae5f..4b1552e1d16c9 100644 --- a/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php @@ -150,7 +150,7 @@ public function warmUp(array $values) $tmpFile = uniqid($this->file, true); file_put_contents($tmpFile, $dump); - @chmod($tmpFile, 0666); + @chmod($tmpFile, 0666 & ~umask()); unset($serialized, $unserialized, $value, $dump); @rename($tmpFile, $this->file); diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index a388721d2c3d5..f02c9a9cbde67 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -58,11 +58,11 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '3.2.5'; - const VERSION_ID = 30205; + const VERSION = '3.2.6'; + const VERSION_ID = 30206; const MAJOR_VERSION = 3; const MINOR_VERSION = 2; - const RELEASE_VERSION = 5; + const RELEASE_VERSION = 6; const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '07/2017';