Skip to content

Commit

Permalink
Add a workaround for PHP-DI over PHP 8.1+
Browse files Browse the repository at this point in the history
  • Loading branch information
flavioheleno committed Mar 6, 2022
1 parent f57fe70 commit b2c7845
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion bin/console.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@
$containerBuilder = new ContainerBuilder();

if (isset($_ENV['PHP_ENV']) && $_ENV['PHP_ENV'] === 'production') {
$containerBuilder->enableCompilation(__DIR__ . '/../var/cache');
// workaround for https://github.com/PHP-DI/PHP-DI/issues/791
if (version_compare(PHP_VERSION, '8.1.0', '<')) {
$containerBuilder->enableCompilation(__DIR__ . '/../var/cache');
}
}

// Set up settings
Expand Down
5 changes: 4 additions & 1 deletion public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
$containerBuilder = new ContainerBuilder();

if (isset($_ENV['PHP_ENV']) && $_ENV['PHP_ENV'] === 'production') {
$containerBuilder->enableCompilation(__DIR__ . '/../var/cache');
// workaround for https://github.com/PHP-DI/PHP-DI/issues/791
if (version_compare(PHP_VERSION, '8.1.0', '<')) {
$containerBuilder->enableCompilation(__DIR__ . '/../var/cache');
}
}

// Set up settings
Expand Down

0 comments on commit b2c7845

Please sign in to comment.