diff --git a/composer.json b/composer.json
index 91da11d4e..f9a34ba5b 100644
--- a/composer.json
+++ b/composer.json
@@ -38,32 +38,32 @@
"sensiolabs/security-checker": "^6.0",
"siriusphp/upload": "^3.0.1",
"squirrelphp/twig-php-syntax": "^1.5",
- "symfony/asset": "^4.4",
- "symfony/console": "^4.4",
- "symfony/debug-bundle": "^4.4",
- "symfony/dependency-injection": "^4.4",
- "symfony/dotenv": "^4.4",
- "symfony/expression-language": "^4.4",
+ "symfony/asset": "^5.1",
+ "symfony/console": "^5.1",
+ "symfony/debug-bundle": "^5.1",
+ "symfony/dependency-injection": "^5.1",
+ "symfony/dotenv": "^5.1",
+ "symfony/expression-language": "^5.1",
"symfony/flex": "^1.6",
- "symfony/form": "^4.4",
- "symfony/framework-bundle": "^4.4",
- "symfony/http-client": "^4.4",
- "symfony/mailer": "^4.4",
+ "symfony/form": "^5.1",
+ "symfony/framework-bundle": "^5.1",
+ "symfony/http-client": "^5.1",
+ "symfony/mailer": "^5.1",
"symfony/maker-bundle": "^1.14",
- "symfony/monolog-bridge": "^4.4",
+ "symfony/monolog-bridge": "^5.1",
"symfony/monolog-bundle": "^3.5",
"symfony/polyfill-php72": "^1.13",
- "symfony/security-bundle": "^4.4",
- "symfony/serializer": "^4.4",
- "symfony/stopwatch": "^4.4",
- "symfony/translation": "^4.4",
- "symfony/twig-bundle": "^4.4",
- "symfony/validator": "^4.4",
- "symfony/var-dumper": "^4.4",
- "symfony/web-profiler-bundle": "^4.4",
+ "symfony/security-bundle": "^5.1",
+ "symfony/serializer": "^5.1",
+ "symfony/stopwatch": "^5.1",
+ "symfony/translation": "^5.1",
+ "symfony/twig-bundle": "^5.1",
+ "symfony/validator": "^5.1",
+ "symfony/var-dumper": "^5.1",
+ "symfony/web-profiler-bundle": "^5.1",
"symfony/web-server-bundle": "^4.4",
"symfony/webpack-encore-bundle": "^1.7",
- "symfony/yaml": "^4.4",
+ "symfony/yaml": "^5.1",
"tightenco/collect": "^7.4",
"twig/twig": "^3.0",
"ua-parser/uap-php": "^3.9",
@@ -101,8 +101,8 @@
"phpunit/phpunit": "^7.5",
"roave/security-advisories": "dev-master@dev",
"se/selenium-server-standalone": "^3.141",
- "symfony/browser-kit": "^4.4",
- "symfony/css-selector": "^4.4",
+ "symfony/browser-kit": "^5.1",
+ "symfony/css-selector": "^5.1",
"symplify/easy-coding-standard": "^8.0",
"vaimo/binary-chromedriver": "^5.0"
},
@@ -115,7 +115,7 @@
"extra": {
"symfony": {
"allow-contrib": true,
- "require": "^4.4"
+ "require": "^5.1"
}
},
"autoload": {
diff --git a/config/bolt/config.yaml b/config/bolt/config.yaml
index e91d7402f..5e5198f9f 100644
--- a/config/bolt/config.yaml
+++ b/config/bolt/config.yaml
@@ -137,12 +137,12 @@ thumbnails:
# user that PHP (and/or your webserver) is running as, and the user who owns the
# actual folders/files.
#
-# - If they are the same user, use `0755` for folders and `0644` for files.
-# - If they're in the same group, use use `0775` for folders and `0664` for files.
-# - If you don't know, or you can't make it work otherwise, then use `0777` for folders and `0666` for files.
+# - If they are the same user, use `0o755` for folders and `0o644` for files.
+# - If they're in the same group, use use `0o775` for folders and `0o664` for files.
+# - If you don't know, or you can't make it work otherwise, then use `0o777` for folders and `0o666` for files.
filepermissions:
- folders: 0775
- files: 0664
+ folders: 0o775
+ files: 0o664
# Define the HTML tags and attributes that are allowed in cleaned HTML. This
# is used for sanitizing HTML, to make sure there are no undesirable elements
diff --git a/phpstan.neon b/phpstan.neon
index fafde8447..824f225d1 100644
--- a/phpstan.neon
+++ b/phpstan.neon
@@ -2,7 +2,7 @@ parameters:
tmpDir: var/cache/ecs
level: 5
symfony:
- container_xml_path: '%rootDir%/../../../var/cache/dev/srcBolt_KernelDevDebugContainer.xml'
+ container_xml_path: '%rootDir%/../../../var/cache/dev/Bolt_KernelDevDebugContainer.xml'
ignoreErrors:
# false positive: `Unreachable statement - code above always terminates.`
@@ -16,12 +16,6 @@ parameters:
message: '#Call to an undefined method Knp\\DoctrineBehaviors\\Contract\\Entity\\TranslationInterface#'
path: %currentWorkingDirectory%/src/*
- # false positive: `Method Symfony\Contracts\EventDispatcher\EventDispatcherInterface::dispatch() invoked with 2 parameters, 1 required.`
- # We skip this error, because it's still what the docs recommend: https://symfony.com/doc/current/components/event_dispatcher.html#dispatch-the-event
- -
- message: '#EventDispatcherInterface::dispatch\(\) invoked with 2 parameters#'
- path: %currentWorkingDirectory%/src/*
-
includes:
- vendor/phpstan/phpstan-symfony/extension.neon
- vendor/phpstan/phpstan-doctrine/extension.neon
diff --git a/phpunit.bootstrap.php b/phpunit.bootstrap.php
index 7fb687a8a..29b937120 100644
--- a/phpunit.bootstrap.php
+++ b/phpunit.bootstrap.php
@@ -14,5 +14,6 @@
$application->run(new \Symfony\Component\Console\Input\StringInput('doctrine:database:drop --force --quiet'));
$application->run(new \Symfony\Component\Console\Input\StringInput('doctrine:database:create --quiet'));
$application->run(new \Symfony\Component\Console\Input\StringInput('doctrine:schema:create --quiet'));
+$application->run(new \Symfony\Component\Console\Input\StringInput('doctrine:fixtures:load --no-interaction --group=without-images'));
$kernel->shutdown();
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 664a2a02b..853b21df5 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -38,9 +38,8 @@
-
-
-
-
+
+
+
+
diff --git a/src/Canonical.php b/src/Canonical.php
index 099203443..89629a954 100644
--- a/src/Canonical.php
+++ b/src/Canonical.php
@@ -42,7 +42,7 @@ public function __construct(Config $config, UrlGeneratorInterface $urlGenerator,
{
$this->config = $config;
$this->urlGenerator = $urlGenerator;
- $this->request = $requestStack->getCurrentRequest();
+ $this->request = $requestStack->getCurrentRequest() ?? Request::createFromGlobals();
$this->defaultLocale = $defaultLocale;
$this->init();
@@ -51,7 +51,7 @@ public function __construct(Config $config, UrlGeneratorInterface $urlGenerator,
public function init(): void
{
// Ensure in request cycle (even for override).
- if ($this->request === null) {
+ if ($this->request === null || $this->request->getHost() === '') {
return;
}
@@ -182,7 +182,7 @@ public function generateLink(?string $route, ?array $params, $canonical = false)
$params,
$canonical ? UrlGeneratorInterface::ABSOLUTE_URL : UrlGeneratorInterface::ABSOLUTE_PATH
);
- } catch (InvalidParameterException | MissingMandatoryParametersException | RouteNotFoundException $e) {
+ } catch (InvalidParameterException | MissingMandatoryParametersException | RouteNotFoundException | \TypeError $e) {
// Just use the current URL /shrug
return$this->request->getUri();
}
diff --git a/src/Controller/TwigAwareController.php b/src/Controller/TwigAwareController.php
index 5fb4fac85..5d4ac1aaf 100644
--- a/src/Controller/TwigAwareController.php
+++ b/src/Controller/TwigAwareController.php
@@ -10,7 +10,6 @@
use Bolt\Storage\Query;
use Bolt\Utils\Sanitiser;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
-use Symfony\Bundle\TwigBundle\Loader\NativeFilesystemLoader;
use Symfony\Component\Asset\Packages;
use Symfony\Component\Asset\PathPackage;
use Symfony\Component\Asset\VersionStrategy\EmptyVersionStrategy;
@@ -101,7 +100,7 @@ protected function renderTemplate($template, array $parameters = [], ?Response $
private function setTwigLoader(): void
{
- /** @var NativeFilesystemLoader $twigLoaders */
+ /** @var FilesystemLoader $twigLoaders */
$twigLoaders = $this->twig->getLoader();
$path = $this->config->getPath('theme');
diff --git a/src/Entity/Field/FileExtrasTrait.php b/src/Entity/Field/FileExtrasTrait.php
index 08434ec29..880c64a28 100644
--- a/src/Entity/Field/FileExtrasTrait.php
+++ b/src/Entity/Field/FileExtrasTrait.php
@@ -14,7 +14,7 @@ private function getPath(): string
{
$filesPackage = new PathPackage('/files/', new EmptyVersionStrategy());
- return $filesPackage->getUrl($this->get('filename'));
+ return $filesPackage->getUrl((string) $this->get('filename'));
}
private function getUrl(): string
diff --git a/src/Extension/BaseExtension.php b/src/Extension/BaseExtension.php
index 70062ae9a..e154200b0 100644
--- a/src/Extension/BaseExtension.php
+++ b/src/Extension/BaseExtension.php
@@ -10,7 +10,6 @@
use Composer\Package\CompletePackage;
use Composer\Package\PackageInterface;
use ComposerPackages\Packages;
-use Symfony\Bundle\TwigBundle\Loader\NativeFilesystemLoader;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Twig\Environment;
use Twig\Extension\ExtensionInterface as TwigExtensionInterface;
@@ -94,7 +93,7 @@ public function addTwigNamespace(string $namespace = '', string $foldername = ''
return;
}
- /** @var NativeFilesystemLoader $twigLoaders */
+ /** @var FilesystemLoader $twigLoaders */
$twigLoaders = $this->getTwig()->getLoader();
if ($twigLoaders instanceof FilesystemLoader) {
diff --git a/src/Twig/ContentExtension.php b/src/Twig/ContentExtension.php
index 27693ed40..9ad4a3877 100644
--- a/src/Twig/ContentExtension.php
+++ b/src/Twig/ContentExtension.php
@@ -92,7 +92,7 @@ public function __construct(
$this->contentRepository = $contentRepository;
$this->csrfTokenManager = $csrfTokenManager;
$this->security = $security;
- $this->request = $requestStack->getCurrentRequest();
+ $this->request = $requestStack->getCurrentRequest() ?? Request::createFromGlobals();
$this->config = $config;
$this->query = $query;
$this->taxonomyRepository = $taxonomyRepository;
diff --git a/src/Utils/ContentHelper.php b/src/Utils/ContentHelper.php
index d7af22c81..7fe38df34 100644
--- a/src/Utils/ContentHelper.php
+++ b/src/Utils/ContentHelper.php
@@ -8,6 +8,7 @@
use Bolt\Configuration\Config;
use Bolt\Entity\Content;
use Bolt\Entity\Field\Excerptable;
+use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
class ContentHelper
@@ -15,7 +16,7 @@ class ContentHelper
/** @var Canonical */
private $canonical;
- /** @var \Symfony\Component\HttpFoundation\Request|null */
+ /** @var Request */
private $request;
/** @var Config */
@@ -24,7 +25,7 @@ class ContentHelper
public function __construct(Canonical $canonical, RequestStack $requestStack, Config $config)
{
$this->canonical = $canonical;
- $this->request = $requestStack->getCurrentRequest();
+ $this->request = $requestStack->getCurrentRequest() ?? Request::createFromGlobals();
$this->config = $config;
}
diff --git a/symfony.lock b/symfony.lock
index d06552a56..8319c0c23 100644
--- a/symfony.lock
+++ b/symfony.lock
@@ -710,9 +710,6 @@
"symfony/css-selector": {
"version": "v4.4.4"
},
- "symfony/debug": {
- "version": "v4.4.4"
- },
"symfony/debug-bundle": {
"version": "4.1",
"recipe": {
diff --git a/tests/php/Repository/TaxonomyRepositoryTest.php b/tests/php/Repository/TaxonomyRepositoryTest.php
index 5e166e685..63f8505a3 100644
--- a/tests/php/Repository/TaxonomyRepositoryTest.php
+++ b/tests/php/Repository/TaxonomyRepositoryTest.php
@@ -8,18 +8,10 @@
use Bolt\Tests\DbAwareTestCase;
/**
- * @todo Add represenative tests here, when methods are implemented in TaxonomyRepository
+ * @todo Add representative tests here, when methods are implemented in TaxonomyRepository
*/
class TaxonomyRepositoryTest extends DbAwareTestCase
{
- protected function setUp(): void
- {
- parent::setUp();
-
- // fixtures loading takes a lot of time, it would be better to load database dump for tests
- self::runCommand('doctrine:fixtures:load --no-interaction --group=without-images');
- }
-
public function testSearchByType(): void
{
$taxonomies = $this->getEm()
diff --git a/tests/php/Repository/UserRepositoryTest.php b/tests/php/Repository/UserRepositoryTest.php
index 726940607..5d7c8f399 100644
--- a/tests/php/Repository/UserRepositoryTest.php
+++ b/tests/php/Repository/UserRepositoryTest.php
@@ -9,14 +9,6 @@
class UserRepositoryTest extends DbAwareTestCase
{
- protected function setUp(): void
- {
- parent::setUp();
-
- // fixtures loading takes a lot of time, it would be better to load database dump for tests
- self::runCommand('doctrine:fixtures:load --no-interaction --group=without-images');
- }
-
public function testFindOneByUsername(): void
{
$admin = $this->getEm()->getRepository(User::class)->findOneByUsername('admin');