Bug #75679 [NEW]: Path 260 character problem
| From: | r dot wagler at gmx dot net | Date: | Wed, 13 Dec 2017 23:34:37 +0000 |
| Subject: | Bug #75679 [NEW]: Path 260 character problem | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-213086@lists.php.net to get a copy of this message | ||
From: r dot wagler at gmx dot net
Operating system: Windows 8.1 Pro
PHP version: 7.2.0
Package: Filesystem function related
Bug Type: Bug
Bug description:Path 260 character problem
Description:
------------
Function copy () can not handle files with pathes of strlen () == 260
characters.
Pathes with less or more then 260 characters are *not* affected.
---
> The version number of the PHP package or files you are using.
http://windows.php.net/downloads/releases/php-7.2.0-nts-Win32-VC15-x64.zip
> Any changes made in your php.ini compared to php.ini-dist or
php.ini-recommended (not your whole php.ini!)
I made a clean copy of php.ini-production (copy php.ini-production
php.ini).
Test script:
---------------
<?PHP
$Files2Report =
[
str_pad ('C:/TEMP/' . str_repeat (str_pad ('path_259_characters_long_'
. microtime (true), 100, '_') . '/', 2), 259, '_') => [],
str_pad ('C:/TEMP/' . str_repeat (str_pad ('path_260_characters_long_'
. microtime (true), 100, '_') . '/', 2), 260, '_') => [],
str_pad ('C:/TEMP/' . str_repeat (str_pad ('path_261_characters_long_'
. microtime (true), 100, '_') . '/', 2), 261, '_') => [],
];
foreach ($Files2Report as $file => &$Report)
{
$Report = ['strlen' => strlen ($file), 'result' => 'nok'];
if (! is_dir (dirname ($file))) mkdir (dirname ($file), 0777, true);
if (@copy (__FILE__, $file) && is_file ($file))
{
$Report['result'] = 'ok';
}
print_r ($Report);
}
//print_r ([$Files2Report, phpversion ()]);
?>
Expected result:
----------------
Array
(
[strlen] => 259
[result] => ok
)
Array
(
[strlen] => 260
[result] => ok
)
Array
(
[strlen] => 261
[result] => ok
)
Actual result:
--------------
Array
(
[strlen] => 259
[result] => ok
)
PHP Warning:
copy(C:/TEMP/path_260_characters_long_1513207625.2858____________________________________________________________/path_260_characters_long_1513207625.2858____________________________________________________________/__________________________________________________):
failed to open stream: No such file or directory in
...\path_260_character_problem.php on line 13
Array
(
[strlen] => 260
[result] => nok
)
Array
(
[strlen] => 261
[result] => ok
)
--
Edit bug report at https://bugs.php.net/bug.php?id=75679&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75679&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75679&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75679&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75679&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75679&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75679&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75679&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75679&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75679&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75679&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75679&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75679&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75679&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75679&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75679&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75679&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75679&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75679&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75679&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75679&r=mysqlcfg