|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2018-08-27 14:47 UTC] peehaa@php.net
Description: ------------ On Windows when requiring a file it seems phpdbg blocks writing to that same file. Same goes trying to unlink() the file Test script: --------------- <?php file_put_contents(__DIR__ . '/configuration.php', 'test'); require __DIR__ . '/configuration.php'; file_put_contents(__DIR__ . '/configuration.php', 'other data'); // neither file_put_contents nor unlink work //unlink(__DIR__ . '/configuration.php'); Expected result: ---------------- > phpdbg -qrr test.php test Actual result: -------------- > php test.php (with file_put_contents()) test > php test.php (with unlink()) test > phpdbg -qrr test.php (with file_put_contents()) test [PHP Warning: file_put_contents(\path\to/configuration.php): failed to open stream: Permission denied in \path\to\test.php on line 7] > phpdbg -qrr test.php (with unlink()) [PHP Warning: unlink(\path\to/configuration.php): Resource temporarily unavailable in \path\to\test.php on line 9] Patchesrelease-file-handle (last revision 2018-08-28 12:55 UTC by cmb@php.net)Pull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 14:00:01 2025 UTC |
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"; ```I've been debugging with this further and rediscovered what I was seeing with this patch Using phpdbg, files which were included using `include` or `require` are not added to the list of included files, and are then included again when `include_once` is called. Test script: --------------- <?php require('example.php'); print_r(get_included_files()); Expected result: --------------- Array ( [0] => /private/tmp/argh/test2.php [1] => /private/tmp/argh/example.php ) Actual result with PHP: --------------- 2015 nicols@boysenberry:/tmp/argh> php test2.php Array ( [0] => /private/tmp/argh/test2.php [1] => /private/tmp/argh/example.php ) Actual result with PHPDBG before this patch: --------------- 2011 nicols@boysenberry:/tmp/argh> phpdbg -rr test2.php [Welcome to phpdbg, the interactive PHP debugger, v0.5.0] To get help using phpdbg type "help" and press enter [Please report bugs to <http://bugs.php.net/report.php>] Array ( [0] => /private/tmp/argh/example.php ) Actual result with PHPDBG after this patch: --------------- 2016 nicols@boysenberry:/tmp/argh> phpdbg -rr test2.php [Welcome to phpdbg, the interactive PHP debugger, v0.5.0] To get help using phpdbg type "help" and press enter [Please report bugs to <http://bugs.php.net/report.php>] Array ( ) Overall effect of the proposed change: --------------- File handles are now closed correctly Files which have been included with `include` or `require` are not added to the list of included files, and are re-included the first time that `include_once` or `require_once` is called.