Edit report at http://bugs.php.net/bug.php?id=53407&edit=1

 ID:                 53407
 Updated by:         ahar...@php.net
 Reported by:        stolen dot data dot net at gmail dot com
 Summary:            make scandir()'s directory sorting optional
-Status:             Assigned
+Status:             Closed
 Type:               Feature/Change Request
 Package:            Directory function related
 Operating System:   applies to all (OpenBSD for me)
 PHP Version:        5.3.3
 Assigned To:        aharvey
 Block user comment: N
 Private report:     N

 New Comment:

This bug has been fixed in SVN.

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

Implemented on trunk, although I've prefixed the constants with

SCANDIR_ to match our usual constant naming a bit better, hence

SCANDIR_SORT_ASCENDING, SCANDIR_SORT_DESCENDING and SCANDIR_SORT_NONE.


Previous Comments:
------------------------------------------------------------------------
[2010-11-26 10:52:30] ahar...@php.net

Automatic comment from SVN on behalf of aharvey
Revision: http://svn.php.net/viewvc/?view=revision&revision=305765
Log: Implemented FR #53407 (make scandir()'s directory sorting
optional).

------------------------------------------------------------------------
[2010-11-26 10:43:35] ahar...@php.net

This looks safe enough to implement on trunk: a Google Code Search

returns no instances of a value other than 0 or 1 being used as

the second parameter to scandir(), so I think as long as we document

this in the UPGRADING file, this should be OK.

------------------------------------------------------------------------
[2010-11-25 21:20:52] stolen dot data dot net at gmail dot com

Description:
------------
---

>From manual page: http://www.php.net/function.scandir

---



Currently, scandir() commits some "userland villainry" by enforcing
alphanumerical 

sorting of the directory entries it pulls. In some cases I needed a
"natural" 

order of the entries in a directory. In another more obvious case,
scandir() 

created notable CPU overhead from always sorting entries in a rather
huge 

directory that was frequently read in the application. I had to go back
to PHP4's 

opendir/readdir to solve the problem.



I'd like to suggest that scandir() gets new constants introduced to
$sorting_order 

in order to make the sorting optional: something like SORT_NONE,
SORT_ASCENDING 

and SORT_DESCENDING.



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53407&edit=1

Reply via email to