|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35998 getPathname() method always returns unix style filenames.
Submitted: 2006-01-13 17:07 UTC Modified: 2006-01-16 09:44 UTC
From: rquadling at gmail dot com Assigned: helly (profile)
Status: Closed Package: SPL related
PHP Version: 5.1.2 OS: Win*
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
48 - 31 = ?
Subscribe to this entry?

 [2006-01-13 17:07 UTC] rquadling at gmail dot com
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:
foreach(new DirectoryIterator('C:\\') as $o_FILE)
	echo $o_FILE->getPathname() . "\t" . realpath($o_FILE->getPathname()) . "\n";


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-01-13 17:48 UTC]
Assigned to the maintainer.
 [2006-01-13 20:37 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

Not that it buys you anything besides what you are typically used to see.
 [2006-01-16 09:44 UTC] rquadling at gmail dot com
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.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Sep 27 05:05:53 2022 UTC