From 9a53df6f73a237e35132e5b7a6bef3afe4fd681b Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Wed, 12 Jun 2024 06:42:03 -0700 Subject: [PATCH] [ticket/17336] Move object instantiation outside of the loop PHPBB-17336 Signed-off-by: Matt Friedman --- phpBB/phpbb/composer/installer.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/phpbb/composer/installer.php b/phpBB/phpbb/composer/installer.php index a18e49d24d..a54e315ca0 100644 --- a/phpBB/phpbb/composer/installer.php +++ b/phpBB/phpbb/composer/installer.php @@ -476,6 +476,8 @@ class installer */ private function get_compatible_versions(array $compatible_packages, ConstraintInterface $core_constraint, $core_stability, $package_name, array $versions) { + $version_parser = new VersionParser(); + $core_stability_value = BasePackage::$stabilities[$core_stability]; /** @var PackageInterface $version */ @@ -505,7 +507,6 @@ class installer // Check for compatibility with phpBB if 'phpbb/phpbb' exists in 'soft-require' if (isset($extra['soft-require']['phpbb/phpbb'])) { - $version_parser = new VersionParser(); $package_constraint = $version_parser->parseConstraints($extra['soft-require']['phpbb/phpbb']); if (!$package_constraint->matches($core_constraint)) {