Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GH-7910: rename fails on Windows if the target is being executed #9351

Draft
wants to merge 2 commits into
base: PHP-8.1
Choose a base branch
from

Conversation

cmb69
Copy link
Contributor

@cmb69 cmb69 commented Aug 16, 2022

Prior to commit c732ab4[1], the script file was closed immediately
after compilation, but the destruction has been properly moved to the
initialization side. Still, at least closing the stream needs to be
done right after compilation to avoid too many open file handles (e.g.
php -F), and to avoid some limitations on Windows. Thus, we
introduce zend_stream_close() which only closes the stream, and is
called from zend_file_handle_dtor().

[1] c732ab4

@cmb69 cmb69 linked an issue Aug 16, 2022 that may be closed by this pull request
Prior to commit c732ab4[1], the script file was closed immediately
after compilation, but the destruction has been properly moved to the
initialization side.  Still, at least closing the stream needs to be
done right after compilation to avoid too many open file handles (e.g.
`php -F`), and to avoid some limitations on Windows.  Thus, we
introduce `zend_stream_close()` which only closes the stream, and is
called from `zend_file_handle_dtor()`.

[1] <php@c732ab4>
@nicolas-grekas
Copy link
Contributor

Friendly bump, this issue is being reported again on Symfony, see symfony/symfony#50326

@lufog
Copy link

lufog commented Mar 16, 2024

Also, on the Windows platform, self-upgrade in Grav CMS is broken. Because unlink() cannot remove currently running script. Because of this, I had to return to PHP 7, which does not have this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rename fails on Windows PHP 8.1 if the target file is being executed
3 participants