Bug #70943 [NEW]: fopen() can't open a file if path is 259 characters long
| From: | emanuele at fondani dot it | Date: | Thu, 19 Nov 2015 18:01:11 +0000 |
| Subject: | Bug #70943 [NEW]: fopen() can't open a file if path is 259 characters long | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-197336@lists.php.net to get a copy of this message | ||
From: emanuele at fondani dot it
Operating system: Windows 10
PHP version: 5.6.15
Package: Filesystem function related
Bug Type: Bug
Bug description:fopen() can't open a file if path is 259 characters long
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 bug report at https://bugs.php.net/bug.php?id=70943&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70943&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70943&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70943&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70943&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70943&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70943&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70943&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70943&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70943&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70943&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70943&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70943&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70943&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70943&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70943&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70943&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70943&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70943&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70943&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70943&r=mysqlcfg