Skip to content

[Process] WindowsPipes needs to be updated for PHP 8.5 #60128

@sebastianbergmann

Description

@sebastianbergmann

Symfony version(s) affected

5.4.47

Description

After php/php-src@5544be7 (https://wiki.php.net/rfc/marking_return_value_as_important), Composer does not work on PHP 8.5 on Windows anymore:

  • flock() "demands" that its return value is either used or explicitly ignored (using the new (void) cast)
  • WindowsPipes calls flock() without using (or explicitly ignoring) its return value
  • flock() triggers an E_WARNING
  • This E_WARNING leads to an error

You can see the error in https://github.com/sebastianbergmann/php-code-coverage/actions/runs/14234238052/job/39890575323: Error: The return value of function flock() should either be used or intentionally ignored by casting it as (void), as locking the stream might have failed.

How to reproduce

Use symfony/process with PHP 8.5 on Windows.

Possible Solutions

  • Use the return value of flock() and throw an exception when it is false (recommended)
  • Assign the return value of flock() to a variable to work around the problem in PHP < 8.5 (not recommended)
  • Cast the return value of flock() to void to work around the problem in PHP >= 8.5 (not recommended)

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