Open
Description
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
callsflock()
without using (or explicitly ignoring) its return valueflock()
triggers anE_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 isfalse
(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()
tovoid
to work around the problem in PHP >= 8.5 (not recommended)