Bug #74283 [Opn->Nab]: Cannot write nor copy to file names ending with dot.
| From: | ab@php.net | Date: | Tue, 21 Mar 2017 16:09:07 +0000 |
| Subject: | Bug #74283 [Opn->Nab]: Cannot write nor copy to file names ending with dot. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-207984@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74283&edit=1
ID: 74283
Updated by: ab@php.net
Reported by: pavel dot hlousek at gmail dot com
Summary: Cannot write nor copy to file names ending with dot.
-Status: Open
+Status: Not a bug
Type: Bug
Package: Filesystem function related
Operating System: Windows
PHP Version: 7.1.3
Block user comment: N
Private report: N
New Comment:
Thanks for the report. The behavior change is intentional. Paths with trailing dots are invalid on
Windows. Why it happens in 7.1 is, that we are now occasionally forced to use the long path prefix
and thus have to be more strict with the path normalization. Otherwise, if "test" exists,
accessing "test." is tolerated. Further reading is also here https://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx?f=255&MSPPError=-2147217396#naming_conventions
Thanks.
Previous Comments:
------------------------------------------------------------------------
[2017-03-21 12:24:57] pavel dot hlousek at gmail dot com
Description:
------------
PHP5.6 handled the same way file names without extension written either "filename" or
"filename." (with dot character at the end of the file name).
PHP7.1.3 handles both forms of file name only in some of the functions but throws warning
"Permission denied" in others.
OK functions: file_get_contents, file_exists
Bad functions: file_put_contents, copy, rename
Test script:
---------------
1)
file_put_contents('test.', 'test.');
2)
file_put_contents('test.txt', 'test.txt');
copy('test.txt', 'test.');
3)
file_put_contents('test.txt', 'test.txt');
rename('test.txt', 'test.');
Expected result:
----------------
1) File "test" written to file system with "test." content.
2) File "test" exists in file system with "test.txt" content.
3) File "test" exists in file system with "test.txt" content.
Actual result:
--------------
1-3) Warning: Permission denied.
Files not created.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74283&edit=1