Page 1 of 1

[fixed] Bug in Admin -> Media library

Posted: Wed Jun 29, 2005 12:31 am
by jdhawk
I'm using .8beta4 at the moment, but looked at the .81 source and the bug still seems to be there.

I have about 10 images in the /uploads/ directory.

Create a new directory using Admin -> Manage Directory (I created "Images") and leave it empty. Should now have /uploads/Images/ with no contents.

Goto the Admin -> Media Library and you should see:

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /usr/dh0/websites/dh0/docroot/blog/include/functions_images.inc.php on line 1200
Filters - Find media

Code: Select all

function serendipity_traversePath($basedir, $dir='', $onlyDirs=true, $pattern = NULL, $depth = 1) {


    $dh = @opendir($basedir . '/' . $dir);
    if ( !$dh ) {
        return array();
    }

changing the return from false; to array(); fixed the error message and I have yet to see any ill side effects.[/code]

Posted: Wed Jun 29, 2005 10:36 am
by winkiller
I really can't reproduce that bug, not on my normal installation of 0.8.1 on Linux and not on a freshly installed one on Windows.
could you try upgrading to 0.8.1 or
do a fulltext search for "serendipity_traversePath" over all your files in the installation of 0.8beta4 and make a diff of the lines concerned?
Just because serendipity_traversePath() hasn't been changed in 0.8.1 it doesn't have to mean the callers haven't been changed.

Mhm, my PHP4 has no problems with that false:
<pre>
<?php
$a = array("one");
$b = array("two");
$c = false;
var_dump(array_merge($a,$b));
var_dump(array_merge($a,$c));
?>
</pre>
gives a
array(2) {
[0]=>
string(3) "one"
[1]=>
string(3) "two"
}
array(2) {
[0]=>
string(3) "one"
[1]=>
bool(false)
}

AHA, the error only occurs with PHP5
array(2) {
[0]=>
string(3) "one"
[1]=>
string(3) "two"
}


Warning: array_merge() [function.array-merge]: Argument #2 is not an array in D:\Apps\xampp\htdocs\array_merge.php on line 7

NULL
I think your patch seems fine, let's see if I can commit it.

Posted: Wed Jun 29, 2005 11:14 am
by winkiller
up and running, thanks for the fix

I've try to add a manual note, without success for the moment