CodeIgniter Forums

Full Version: Using file helper get_filenames() is very buggy for me
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Ian Beck[/eluser]
I'm having a rather major problem using the file helper's get_filenames() function.

The first time I use it things work fine. If I use it a second time, the results it returns are the first results, followed by the second results. For example:

Dir1 contains the files File1 and File2.
Dir2 contains the files File3 and File4.
My site has index.php, Dir1, and Dir2 all in the root folder.

I run:

$first_files = get_filenames('./Dir1/');
$second_files = get_filenames('./Dir2/');

$first_files ends up being:
Array( 0 => 'File1', 1 => 'File2' )

$second_files ends up being:
Array( 0 => 'File1', 1 => 'File2', 2 => 'File3', 3 => 'File4' )

I've double checked the default file_helper.php, but it looks fine (should be rewriting the array that it returns every time it gets called).

I'm running PHP 4.x, CodeIgniter 1.5.4, and the helper is being called from within a Matchbox module.

Any ideas what the heck might be going wrong and how I can fix it?

El Forum

[eluser]Armchair Samurai[/eluser]
See this bug report for possible solutions: this bugt has been around for a long time and still hasn't been patched.

El Forum

[eluser]Ian Beck[/eluser]
Excellent, thanks for the link! My searching didn't turn that up for some reason.

Gotta love the bugs that never get addressed. Time to get overriding or hacking, I suppose.

El Forum

[eluser]Derek Allard[/eluser]
Hi Guys... sorry for the delay. The report got buried, but I just wanted to say that I had fixed that bug already (prior to this post), and the fix is available in the SVN repository.