php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30730 Filename path length limit broken on NTFS volume, using rename
Submitted: 2004-11-09 08:15 UTC Modified: 2004-11-11 01:04 UTC
From: dev at viapanda dot com Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.3.9 OS: Windows XP SP2
Private report: No CVE-ID: None
 [2004-11-09 08:15 UTC] dev at viapanda dot com
Description:
------------
I can't find a better summary...
The issue looks complex to me.

By using the rename function, you can create a path whose total length is superior to 255 (?), wich "appears" to be some limit on NTFS.

Once you renamed your dir, the files under can't be deleted nor renamed using explorer...
And php is_file stops working

I'm too dumb to understand the windows ntfs spec...

So, the issue is:
"rename() allows you to create path longer than a limit that triggers problems..."

Reproduce code:
---------------
// Create a directory

@mkdir('c:/test');

// Create a file in that directory

$path='c:/test/whatever_the_name_of_this_file';
$fp=@fopen($path, 'wb+');
@fclose($fp);

// Rename that directory in order that the file full path will be long enough to trigger the bug

$destination=str_pad('c:/test', 250, '0');
rename('c:/test', $destination);



Expected result:
----------------
(i) If the whole is incorrect, I would like to have an error from the rename function, and my dir shouldn't be renamed.
(ii) If this is correct, then is_file (and probably other functions) should work correctly on this file

Actual result:
--------------
(i) something is broken in windows (duh!), as you can't rename or delete the file
(ii) php functions like is_file, don't work on that file



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-09 20:50 UTC] derick@php.net
Why do you think this is a bug in PHP and not in Windows?
 [2004-11-10 22:51 UTC] dev at viapanda dot com
Well...
Frankly I don't know, it's out of reach of my understanding.
I'm no way a filesystem expert...

So, do you think it's a pure win bug, and nothing can be done in php to handle this?


Thanks for the work on php.
Best regards,

Olivier
 [2004-11-11 01:04 UTC] iliaa@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

PHP uses your system internal libc to perform the rename operation. This library appears to allow the rename process to go through, so it's not a bug in PHP.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 10:01:28 2024 UTC