|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-01-13 17:07 UTC] rquadling at gmail dot com
Description:
------------
The pathnames returned by DirectoryIterator::getPathname() are always with '/'. Which is no good for windows.
In /* $Id: spl_directory.c,v 1.63 2006/01/01 13:09:54 sniper Exp $ */ Line 165 the culprit is the "%s/%s".
Ideally the filename should come back appropriate to the DEFAULT_SLASH constant defined in tsrm_virtual_cwd.h
This constant is controlled by compiler directive TSRM_WIN32.
This is used in realpath which the PHP code below demonstrates.
Reproduce code:
---------------
<?php
foreach(new DirectoryIterator('C:\\') as $o_FILE)
{
echo $o_FILE->getPathname() . "\t" . realpath($o_FILE->getPathname()) . "\n";
}
?>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 08:00:01 2025 UTC |
Exactly. I use a LOT of PHP scripts to activate other Windows applications which can only understand the \ and not the / and when giving the filename to a user in a report ("The file you are looking for is called ..."), the users will only follow what you tell them! Thanks for fixing it though. Saves me 1 function call per filename. Which will be a lot over time.