Bug #70943 [Opn]: fopen() can't open a file if path is 259 characters long
| From: | yohgaki@php.net | Date: | Tue, 08 Dec 2015 06:52:49 +0000 |
| Subject: | Bug #70943 [Opn]: fopen() can't open a file if path is 259 characters long | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-197675@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70943&edit=1
ID: 70943
Updated by: yohgaki@php.net
Reported by: emanuele at fondani dot it
Summary: fopen() can't open a file if path is 259 characters
long
Status: Open
Type: Bug
Package: Filesystem function related
Operating System: Windows 10
PHP Version: 5.6.15
Block user comment: N
Private report: N
New Comment:
Note: Most file systems support up to 255 chars for file names. Path length are unlimited mostly.
https://en.wikipedia.org/wiki/Comparison_of_file_systems
Previous Comments:
------------------------------------------------------------------------
[2015-11-30 07:06:45] adrian dot ehrsam at students dot fhnw dot ch
This is an issue of composer as well: https://github.com/composer/composer/issues/4628
. It is the well-known Windows Long path Issue that can be fixed.
------------------------------------------------------------------------
[2015-11-19 18:01:09] emanuele at fondani dot it
Description:
------------
fopen() function cannot access files whose path is more than 258 characters long.
Test script:
---------------
<?php
// Generates a sample file whose path is exactly 259 characters long
$testFile = __DIR__."\\".str_repeat("a", 254 -
strlen(__DIR__)).".dat";
echo "Generating a file with a path length of ".strlen($testFile)."
characters...\r\n";
touch($testFile);
echo "Opening file... ";
if ($fp = fopen($testFile, "r")) {
fclose($fp);
echo "OK";
}
Expected result:
----------------
Generating a file with a path length of 259 characters...
Opening file... OK
Actual result:
--------------
Generating a file with a path length of 259 characters...
Opening file...
Warning:
fopen(S:\Emanuele\Temp\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.dat):
failed to open stream: Invalid argument in test.php on line 8
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70943&edit=1