Bug #78600 [NEW]: PHP fails to create a file if its name ends with a dot
| From: | marcelotpcruz at gmail dot com | Date: | Fri, 27 Sep 2019 00:49:25 +0000 |
| Subject: | Bug #78600 [NEW]: PHP fails to create a file if its name ends with a dot | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-222923@lists.php.net to get a copy of this message | ||
From: marcelotpcruz at gmail dot com
Operating system: Windows 7/10
PHP version: 7.3.10
Package: Filesystem function related
Bug Type: Bug
Bug description:PHP fails to create a file if its name ends with a dot
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 bug report at https://bugs.php.net/bug.php?id=78600&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=78600&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78600&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78600&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78600&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78600&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78600&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78600&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78600&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78600&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78600&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=78600&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=78600&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78600&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78600&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78600&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78600&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78600&r=mysqlcfg