Skip to content

Composer dependencies are incompatible with PHP 7.2 #178

Description

@gadnis

Environment

  • PrestaShop: 1.7.6.8
  • PHP: 7.2
  • Module: dpdbaltics v3.3.1
  • Environment: production

Problem

The module fails immediately after installation or deployment with the following error:

Parse error: syntax error, unexpected '=' in
/modules/dpdbaltics/vendor/symfony/string/Resources/functions.php on line 34

The installed package is symfony/string v6.4.34, which requires PHP 8.1 or newer. The failing line uses the ??= operator, which is only supported since PHP 7.4 and therefore cannot be parsed by PHP 7.2.

This is not limited to symfony/string. The generated composer.lock also contained other packages that are incompatible with PHP 7.2, including:

  • symfony/property-access v6.4.25 — requires PHP 8.1 or newer
  • symfony/serializer v8.0.3 — requires PHP 8.4 or newer
  • phpdocumentor/type-resolver v1.12.0 — requires PHP 7.3 or newer

Root cause

The invertus/dpdbaltics-api package declares the following Symfony dependencies without version limits:

{
    "symfony/serializer": "*",
    "symfony/property-access": "*",
    "symfony/property-info": "*"
}

This allows Composer to select current Symfony releases even though they no longer support the PHP version used by PrestaShop 1.7.6.8 installations.

Although the project previously declared PHP 5.6 through config.platform, the committed lock file and bundled vendor directory did not respect that compatibility target.

Suggested fix

Please define the supported PHP platform and replace the unrestricted Symfony constraints with compatible version ranges. For a PHP 7.2 target, the root project can use:

{
    "config": {
        "platform": {
            "php": "7.2.0"
        },
        "prepend-autoloader": false
    },
    "require": {
        "symfony/property-access": "^4.4",
        "symfony/property-info": "^4.4",
        "symfony/serializer": "^4.4"
    }
}

The same version limits should preferably be added directly to invertus/dpdbaltics-api, because that package currently introduces the unrestricted transitive dependencies.

After changing the constraints, regenerate the lock file and production dependencies without ignoring platform requirements:

composer update --with-all-dependencies --no-dev --prefer-dist
composer validate --no-check-publish
composer install --no-dev --dry-run

Do not use --ignore-platform-reqs, as that can recreate a lock file containing packages that cannot run on PHP 7.2.

Verified result

After applying the constraints and regenerating the dependencies, Composer selected:

  • symfony/property-access v4.4.44
  • symfony/property-info v4.4.49
  • symfony/serializer v4.4.47
  • phpdocumentor/type-resolver v1.6.1

The incompatible symfony/string v6.4.34 dependency was removed. Composer validation passed, and Composer confirmed that no installed package conflicts with PHP 7.2.0.

Please update the package constraints and rebuild the distributed composer.lock and vendor directory so that the module remains installable on its documented PrestaShop/PHP environment.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions