Bug #76801 [Com]: require()ing a file blocks writing or deleting the file
| From: | andrew at nicols dot co dot uk | Date: | Tue, 19 Mar 2019 01:36:15 +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-220065@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:
Sadly I'm still seeing this issue on MacOS, and Linux, and it still renders phpdbg entirely
useless for code coverage.
I've just tried applying this patch to the latest 7.2 release and it seems to be working as it
should. The multiple includes are no longer an issue, but I am hitting segfaults on master so
I'm unable to test things further.
cmb@php.net, are you able to progress this by any chance?
Previous Comments:
------------------------------------------------------------------------
[2019-01-08 00:16:18] andrew at nicols dot co dot uk
Related To: Bug #76882
------------------------------------------------------------------------
[2018-09-17 04:11:11] andrew at nicols dot co dot uk
Sorry, to confirm the previous comment relates to the patch suggested by cmb@php.net
Calling a.php via php directly:
2054 nicols@boysenberry:~/git/tmp> php a.php
/Users/nicols/git/tmp/b.php was included
Calling it via phpdbg -qqr:
2055 nicols@boysenberry:~/git/tmp> phpdbg -qqr a.php
/Users/nicols/git/tmp/b.php was included
/Users/nicols/git/tmp/b.php was included
[Script ended normally]
prompt>
Essentially it appears that when called via PHP CLI, a file included via require or include is not
subsequently loaded if called via require_once or include_once.
However if it is called via phpdbg, it is included again.
------------------------------------------------------------------------
[2018-09-17 04:05:37] andrew at nicols dot co dot uk
The attached patch fails with the following test:
a.php:
```
<?php
require('b.php');
require_once('b.php');
```
b.php:
```
<?php
echo __FILE__ . " was included\n";
```
------------------------------------------------------------------------
[2018-09-17 00:25:04] andrew at nicols dot co dot uk
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.
------------------------------------------------------------------------
[2018-09-14 13:49:56] cmb@php.net
Related To: Bug #76882
------------------------------------------------------------------------
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