Skip to content

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

Draft
cmb69 wants to merge 2 commits into
php:PHP-8.1from
cmb69:cmb/gh7910a
Draft

Fix GH-7910: rename fails on Windows if the target is being executed#9351
cmb69 wants to merge 2 commits into
php:PHP-8.1from
cmb69:cmb/gh7910a

Conversation

@cmb69

@cmb69 cmb69 commented Aug 16, 2022

Copy link
Copy Markdown
Member

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
Copy Markdown
Contributor

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

@lufog

lufog commented Mar 16, 2024

Copy link
Copy Markdown

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