diff --git a/CHANGELOG.md b/CHANGELOG.md index 4373aacb..639f08b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] ... +## 3.1.0 - 2019-07-02 + - Add support for Symfony 2.8 (#233, thanks to @nocive) + - Fix handling of ESI requests (#213, thanks to @franmomu) + ## 3.0.0 - 2019-05-10 - Add the `sentry:test` command, to test if the Sentry SDK is functioning properly. diff --git a/composer.json b/composer.json index 20e38c4b..435ce3e7 100644 --- a/composer.json +++ b/composer.json @@ -22,12 +22,12 @@ "php": "^7.1", "jean85/pretty-package-versions": "^1.0", "sentry/sdk": "^2.0", - "symfony/config": "^3.0||^4.0", - "symfony/console": "^3.0||^4.0", - "symfony/dependency-injection": "^3.0||^4.0", - "symfony/event-dispatcher": "^3.0||^4.0", - "symfony/http-kernel": "^3.0||^4.0", - "symfony/security-core": "^3.0||^4.0" + "symfony/config": "^2.8||^3.0||^4.0", + "symfony/console": "^2.8||^3.0||^4.0", + "symfony/dependency-injection": "^2.8||^3.0||^4.0", + "symfony/event-dispatcher": "^2.8||^3.0||^4.0", + "symfony/http-kernel": "^2.8||^3.0||^4.0", + "symfony/security-core": "^2.8||^3.0||^4.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.8", @@ -37,7 +37,7 @@ "phpstan/phpstan-phpunit": "^0.11", "phpunit/phpunit": "^7.5", "scrutinizer/ocular": "^1.4", - "symfony/expression-language": "^3.0||^4.0" + "symfony/expression-language": "^2.8||^3.0||^4.0" }, "autoload": { "psr-4" : { diff --git a/src/DependencyInjection/SentryExtension.php b/src/DependencyInjection/SentryExtension.php index bddca3a8..970ba1bf 100644 --- a/src/DependencyInjection/SentryExtension.php +++ b/src/DependencyInjection/SentryExtension.php @@ -4,8 +4,12 @@ use Sentry\ClientBuilderInterface; use Sentry\Options; +use Sentry\SentryBundle\Command\SentryTestCommand; use Sentry\SentryBundle\ErrorTypesParser; +use Sentry\SentryBundle\EventListener\ConsoleListener; use Sentry\SentryBundle\EventListener\ErrorListener; +use Sentry\SentryBundle\EventListener\RequestListener; +use Sentry\SentryBundle\EventListener\SubRequestListener; use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; use Symfony\Component\Config\FileLocator; use Symfony\Component\Console\ConsoleEvents; @@ -14,6 +18,7 @@ use Symfony\Component\DependencyInjection\Loader; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\HttpKernel\DependencyInjection\Extension; +use Symfony\Component\HttpKernel\Kernel; /** * This is the class that loads and manages your bundle configuration @@ -44,6 +49,7 @@ public function load(array $configs, ContainerBuilder $container) } $this->tagConsoleErrorListener($container); + $this->setLegacyVisibilities($container); } private function passConfigurationToOptions(ContainerBuilder $container, array $processedConfiguration): void @@ -147,4 +153,18 @@ private function tagConsoleErrorListener(ContainerBuilder $container): void $listener->addTag('kernel.event_listener', $tagAttributes); } + + /** + * BC layer for symfony < 3.3, listeners and commands must be public + */ + private function setLegacyVisibilities(ContainerBuilder $container): void + { + if (Kernel::VERSION_ID < 30300) { + $container->getDefinition(SentryTestCommand::class)->setPublic(true); + $container->getDefinition(ConsoleListener::class)->setPublic(true); + $container->getDefinition(ErrorListener::class)->setPublic(true); + $container->getDefinition(RequestListener::class)->setPublic(true); + $container->getDefinition(SubRequestListener::class)->setPublic(true); + } + } }