Bug #78600 [Com]: PHP fails to create a file if its name ends with a dot

From: Date: Fri, 27 Sep 2019 02:09:41 +0000
Subject: Bug #78600 [Com]: PHP fails to create a file if its name ends with a dot
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-222925@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78600&edit=1 ID: 78600 Comment by: marcelotpcruz at gmail dot com Reported by: marcelotpcruz at gmail dot com Summary: PHP fails to create a file if its name ends with a dot Status: Not a bug Type: Bug Package: Filesystem function related Operating System: Windows 7/10 PHP Version: 7.3.10 Block user comment: N Private report: N New Comment: Currently, I missread the prompt behaviour, it discreetly removes the ending dot and creates the file without it. Thanks for your fast answer! Previous Comments: ------------------------------------------------------------------------ [2019-09-27 00:51:19] requinix@php.net https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file > Do not end a file or directory name with a space or a period. Although the underlying file > system may support such > names, the Windows shell and user interface does not. However, it is acceptable to specify a > period as the first > character of a name. For example, ".temp". ------------------------------------------------------------------------ [2019-09-27 00:49:25] marcelotpcruz at gmail dot com Description: ------------ If I create a file manually, named as 'v.', php can read and write it, but can't create or delete. I'm using php -a(Interactive shell). I tested on my server with windows 7 as well with the same results. I also tested on cmd with admin rights as well as nt authority\system(checked with whoami). Test script: --------------- php -a fopen('v.', 'c+');//Does not work file_put_contents('v.', 'dsdsd');//Does not work fopen('v.v', 'c+');//works //Manually create a file .v with ddswd as content echo file_get_contents('v.');//returns ddswd file_put_contents('v.', 'kkk');//works echo file_get_contents('v.');//returns kkk unlink('v.');//Permission denied in php shell code on line 1 unlink('v.v');//works //Delete the file manually than touch touch('v.');//touch(): Unable to create file v. because Permission denied in php shell code on line 1 touch('v');//works Expected result: ---------------- File is created successfully, since I can create it from prompt and notepad++ without error. Actual result: -------------- PHP Warning: fopen(v.): failed to open stream: Permission denied in php shell code on line 1 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78600&edit=1

« previous php.bugs (#222925) next »