From 9c5754acaabc366ff7b1fb768d5054edc6746bdd Mon Sep 17 00:00:00 2001 From: Alexander McCullagh Date: Wed, 18 Dec 2019 15:26:27 +0100 Subject: [PATCH 1/4] [Dotenv] FIX missing getenv --- src/Symfony/Component/Dotenv/Dotenv.php | 2 +- src/Symfony/Component/Dotenv/Tests/DotenvTest.php | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Dotenv/Dotenv.php b/src/Symfony/Component/Dotenv/Dotenv.php index c2475f204a..84e66b1d0b 100644 --- a/src/Symfony/Component/Dotenv/Dotenv.php +++ b/src/Symfony/Component/Dotenv/Dotenv.php @@ -387,7 +387,7 @@ final class Dotenv } elseif (isset($this->values[$name])) { $value = $this->values[$name]; } else { - $value = ''; + $value = (string) getenv($name); } if (!$matches['opening_brace'] && isset($matches['closing_brace'])) { diff --git a/src/Symfony/Component/Dotenv/Tests/DotenvTest.php b/src/Symfony/Component/Dotenv/Tests/DotenvTest.php index 1e493f24bd..965f368643 100644 --- a/src/Symfony/Component/Dotenv/Tests/DotenvTest.php +++ b/src/Symfony/Component/Dotenv/Tests/DotenvTest.php @@ -314,4 +314,15 @@ class DotenvTest extends TestCase $this->assertSame('foo2_prod', $values['TEST2']); } } + + public function testGetVariablesValueFromGetenv() + { + putenv('Foo=Bar'); + + $dotenv = new Dotenv(true); + $values = $dotenv->parse('Foo=${Foo}'); + $this->assertSame('Bar', $values['Foo']); + + putenv('Foo'); + } } From 5e9fa9d75eec67e2283bf7e40008d408a5963573 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 19 Dec 2019 10:47:05 +0100 Subject: [PATCH 2/4] Fix typo --- .../HttpFoundation/Session/Storage/NativeSessionStorage.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php index 4c5873728a..df7da3c72f 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php @@ -375,13 +375,11 @@ class NativeSessionStorage implements SessionStorageInterface * ini_set('session.save_path', '/tmp'); * * or pass in a \SessionHandler instance which configures session.save_handler in the - * constructor, for a template see NativeFileSessionHandler or use handlers in - * composer package drak/native-session + * constructor, for a template see NativeFileSessionHandler. * * @see https://php.net/session-set-save-handler * @see https://php.net/sessionhandlerinterface * @see https://php.net/sessionhandler - * @see https://github.com/zikula/NativeSession * * @param \SessionHandlerInterface|null $saveHandler * From 1c7eda4649cf58efb8cfb71f2a955dc85c7ca77e Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 19 Dec 2019 11:27:02 +0100 Subject: [PATCH 3/4] [DI] skip looking for config class when the extension class is anonymous --- .../Component/DependencyInjection/Extension/Extension.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Symfony/Component/DependencyInjection/Extension/Extension.php b/src/Symfony/Component/DependencyInjection/Extension/Extension.php index 7df483064f..8acb8ee31d 100644 --- a/src/Symfony/Component/DependencyInjection/Extension/Extension.php +++ b/src/Symfony/Component/DependencyInjection/Extension/Extension.php @@ -80,6 +80,11 @@ abstract class Extension implements ExtensionInterface, ConfigurationExtensionIn public function getConfiguration(array $config, ContainerBuilder $container) { $class = \get_class($this); + + if (false !== strpos($class, "\0")) { + return null; // ignore anonymous classes + } + $class = substr_replace($class, '\Configuration', strrpos($class, '\\')); $class = $container->getReflectionClass($class); $constructor = $class ? $class->getConstructor() : null; From a47ae10a9d87bcca6219c0b0e6c678cef414f7eb Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 19 Dec 2019 15:37:13 +0100 Subject: [PATCH 4/4] [ProxyManager] fix generating proxies for root-namespaced classes --- .../Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php | 1 + .../Tests/LazyProxy/Fixtures/php/lazy_service_structure.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php index 1a5c68c04a..549b154f62 100644 --- a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php +++ b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php @@ -97,6 +97,7 @@ EOF; public function getProxyCode(Definition $definition) { $code = $this->classGenerator->generate($this->generateProxyClass($definition)); + $code = preg_replace('/^(class [^ ]++ extends )([^\\\\])/', '$1\\\\$2', $code); $code = preg_replace( '/(\$this->initializer[0-9a-f]++) && \1->__invoke\(\$this->(valueHolder[0-9a-f]++), (.*?), \1\);/', diff --git a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service_structure.txt b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service_structure.txt index 574041b89b..906fff68f7 100644 --- a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service_structure.txt +++ b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service_structure.txt @@ -21,5 +21,5 @@ class LazyServiceProjectServiceContainer extends Container } } -class stdClass_%s extends %SstdClass implements \ProxyManager\%s +class stdClass_%s extends \stdClass implements \ProxyManager\%s {%a}%A