note 109751 added to class.directoryiterator

From: Date: Thu, 16 Aug 2012 18:23:46 +0000
Subject: note 109751 added to class.directoryiterator
Groups: php.notes 
Request: Send a blank email to php-notes+get-190103@lists.php.net to get a copy of this message
Beware of the behavior when using FilesystemIterator::UNIX_PATHS, it's not applied as you might expect. I guess this flag is added especially for use on windows. However, the path you construct the RecursiveDirectoryIterator or FilesystemIterator with will not be available as a unix path. I can't say this is a bug, since most methods are just purely inherited from DirectoryIterator. In my test, I'd expected a complete unix path. Unfortunately... not quite as expected: <?php // say $folder = C:\projects\lang $flags = FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::SKIP_DOTS | FilesystemIterator::UNIX_PATHS; $d_iterator = new RecursiveDirectoryIterator($folder, $flags); echo $d_iterator->getPath(); ?> expected result: /projects/lang (or C:/projects/lang) actual result: C:\projects\lang ---- Server IP: 83.137.20.135 Probable Submitter: 81.205.252.247 ---- Manual Page -- http://www.php.net/manual/en/class.directoryiterator.php Edit -- https://master.php.net/note/edit/109751 Del: integrated -- https://master.php.net/note/delete/109751/integrated Del: useless -- https://master.php.net/note/delete/109751/useless Del: bad code -- https://master.php.net/note/delete/109751/bad+code Del: spam -- https://master.php.net/note/delete/109751/spam Del: non-english -- https://master.php.net/note/delete/109751/non-english Del: in docs -- https://master.php.net/note/delete/109751/in+docs Del: other reasons-- https://master.php.net/note/delete/109751 Reject -- https://master.php.net/note/reject/109751 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#190103) next »