Skip to content

Implement a safer way of installing internal functions instrumentations (curl, PDO, MySQLi, PostgreSQL) on PHP 8.1 #291

Description

@SergeyKleyman

Problem

Currently (as of the last release which at the moment is 1.1.1) the way we install auto-instrumentations that require instrumentation of functions from PHP extensions is by disabling composer's check of PHP requirement
which unfortunately is global and it cannot be limited to specific packages (namely those packages with those auto-instrumentations). composer's behavior in this case is copletely drop PHP version requirement check for all the packages.

For example open-telemetry/sdk (1.9.0) requires ramsey/uuid (4.9.1) requires brick/math (0.14.0).
brick/math 0.14.0 requires PHP 8.2+ and it would have broken the application if loaded in context of PHP 8.1
because in 0.14.0 brick/math introduced the use of PHP 8.2+ readonly classes feature.

Suggestions

For auto-instrumentations requiring PHP 8.2+ packages

We need to add (preferably automatic) safety checks that those auto-instrumentations packages for functions from PHP extensions - for example verifying that the code in those packages is not using any PHP 8.2+ features. This will allow us to update pinned versions of those packages with higher confidence.

For the rest of the packages

We need to make sure that the rest of the packages (other than auto-instrumentations for functions from PHP extensions) are subjected to PHP version requirements.
One possible way to implement it is to:

  • Install package into a temp location
  • Fix the package composer.json to allow PHP 8.1
  • Install "fixed" package via composer local repository instead of the original package from packagist.org
  • Remove --ignore-platform-req=php thus return composer's ability to enforce PHP version requirement

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions