Bug #76801 [Com]: require()ing a file blocks writing or deleting the file
| From: | andrew at nicols dot co dot uk | Date: | Mon, 17 Sep 2018 00:25:05 +0000 |
| Subject: | Bug #76801 [Com]: require()ing a file blocks writing or deleting the file | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-217083@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76801&edit=1
ID: 76801
Comment by: andrew at nicols dot co dot uk
Reported by: peehaa@php.net
Summary: require()ing a file blocks writing or deleting the
file
Status: Open
Type: Bug
Package: phpdbg
Operating System: Windows
PHP Version: 7.2.9
Block user comment: N
Private report: N
New Comment:
I've just tried your patch cmb and it is indeed freeing up files now, but I'm also seeing
files loaded twice in a require_once with this patch.
I haven't been able to replicate it outside of phpunit yet with a simple testcase. This
wasn't happening before I applied the patch.
Previous Comments:
------------------------------------------------------------------------
[2018-09-14 13:49:56] cmb@php.net
Related To: Bug #76882
------------------------------------------------------------------------
[2018-08-30 15:00:03] cmb@php.net
It seems that under the CLI SAPI for the included file
compile_filename()[1] is called, but not under the phpdbg SAPI.
compile_filename() calls zend_destroy_file_hande()[2] after having
called zend_compile_file(). I have checked this on Windows only,
but I guess the calls are the same on Linux.
[1] <https://github.com/php/php-src/blob/php-7.3.0beta2/Zend/zend_language_scanner.l#L643>
[2] <https://github.com/php/php-src/blob/php-7.3.0beta2/Zend/zend_language_scanner.l#L672>
------------------------------------------------------------------------
[2018-08-30 06:03:57] bwoebi@php.net
Then I'm seriously confused, as phpdbg_init_compile_file() does exactly the same thing as
compile_file() does - what am I missing?
------------------------------------------------------------------------
[2018-08-29 14:41:03] cmb@php.net
> So change that patch to just call zend_destroy_file_handle() as
> well inside phpdbg_compile_file() (but not the init).
That wouldn't fix the issue, though.
------------------------------------------------------------------------
[2018-08-29 11:59:07] bwoebi@php.net
No, the caller is the caller calling zend_compile_file().
Compare with the Zend compile_file() https://github.com/php/php-src/blob/php-7.3.0beta2/Zend/zend_language_scanner.l#L621
implementation, which doesn't destroy the handle either
Effectively in https://github.com/php/php-src/blob/php-7.3.0beta2/sapi/phpdbg/phpdbg_prompt.c#L627
phpdbg is just mirroring the behavior of compile_filename() https://github.com/php/php-src/blob/php-7.3.0beta2/Zend/zend_language_scanner.l#L672.
However, the change in https://github.com/php/php-src/blob/php-7.3.0beta2/sapi/phpdbg/phpdbg_list.c#L291
might be fine, where we create our own file handle thus we must close that properly as well.
So change that patch to just call zend_destroy_file_handle() as well inside phpdbg_compile_file()
(but not the init).
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=76801
--
Edit this bug report at https://bugs.php.net/bug.php?id=76801&edit=1