Skip to content

Composer plugin tasks not executed using the PHP version Composer is invoked with #1170

@echernyavskiy

Description

@echernyavskiy

Given:

  • two PHP versions installed side by side - 8.2 and 8.3
  • /usr/bin/php invokes PHP 8.2 (managed via alternatives), so that's the default version
  • Composer is explicitly invoked with PHP 8.3, i.e. /usr/bin/php8.3 ./composer.phar install

In this setup GrumPHP git:init and configure scripts are executed using PHP 8.2 because the plugin calls vendor/bin/grumphp directly instead of using the PHP binary Composer is using for the current invocation.

I'm not familiar with Composer Plugin API enough to tell if Composer exposes internally the PHP binary it was invoked with. However it looks like there is @php syntax for scripts that does something similar to what ${MAKE} would do in a Makefile, so Composer must maintain some sort of reference to the current PHP binary.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions