Bug #81336 [Com]: & in filename doesn't read file with file
| From: | traveldailynews758 at gmail dot com | Date: | Fri, 14 Apr 2023 07:54:40 +0000 |
| Subject: | Bug #81336 [Com]: & in filename doesn't read file with file | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-244195@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=81336&edit=1
ID: 81336
Comment by: traveldailynews758 at gmail dot com
Reported by: remco dot pc at outlook dot com
Summary: & in filename doesn't read file with file
Status: Open
Type: Bug
Package: Filesystem function related
Operating System: win10 - wsl ubuntu-200.4 LTS
PHP Version: 8.0.9
Block user comment: N
Private report: N
New Comment:
Travel Daily Blog are sharing latest news about travel, destination, vaction, camping, desert safari
etc. More info to visit:(https://traveldailyblog.com)github.com
Previous Comments:
------------------------------------------------------------------------
[2021-08-16 00:04:04] antonino dot spampinato86 at gmail dot com
Creating/modifying any files within the Linux subsystem using Windows apps & tools can cause
Data corruption and data loss in Ubuntu subsystem! (Thanks to Rich Turner for suggesting these words
of caution!) This is absolutely not supported. From the same blog post:
Interoperability with Windows
While VolFs files are stored in regular files on Windows in the directories mentioned above,
interoperability with Windows is not supported. If a new file is added to one of these directories
from Windows, it lacks the EAs needed by VolFs, so VolFs doesnât know what to do with the file
and simply ignores it. Many editors will also strip the EAs when saving an existing file, again
making the file unusable in WSL.
error_reporting(-1);
$file = __DIR__ . '/file\\&.mp3';
$result = file($file);
$error = error_get_last();
error_clear_last();
var_dump($error, htmlspecialchars($file), is_array($result));
//Correct Error output example
/*Warning: file(/my_path/file\&.mp3): Failed to open stream: No such file or directory in
/my_path on line 5
array(4) {
["type"]=>
int(2)
["message"]=>
string(70) "file(/my_path/file\&.mp3): Failed to open stream: No such file or
directory"
["file"]=>
string(8) "/my_path"
["line"]=>
int(5)
}
string(23) "/my_path/file\&.mp3"
bool(false)*/
AMPERSAND is a reserved character on WINDOWS, you can search for it enclosed in quotes or
backslashes (natively on Windows). You can try with backslash. Was the file created by php or by
Ubuntu? Can you show more details?
Note* HTML output (browser) & current display to &, but it entity character
------------------------------------------------------------------------
[2021-08-06 12:10:35] cmb@php.net
I checked with & not @. Without further info, I can't help.
Sorry.
------------------------------------------------------------------------
[2021-08-06 11:57:39] remco dot pc at outlook dot com
i did a mistake, php version 8.0.8.
@ sign in file name is ok and reading.
& sign is not reading the file.
i don't get any error messages reading the file.
------------------------------------------------------------------------
[2021-08-06 11:43:58] cmb@php.net
I cannot reproduce with PHP-8.0 on WSL running Debian 9.13 on
Windows 10 either; neither with the file on the host nor in the
guest. Do you get any warning or notice (I assume you have
error_reporting=-1)? Can you provide further info which may help
to make the issue reproducible?
------------------------------------------------------------------------
[2021-08-06 11:06:36] remco dot pc at outlook dot com
os, win10 - wsl ubuntu-200.4 LTS
------------------------------------------------------------------------
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=81336
--
Edit this bug report at https://bugs.php.net/bug.php?id=81336&edit=1