Page 1 of 1

Errors using "Manage directories"

Posted: Thu Mar 24, 2005 11:35 am
by BjoernH
Hi!

I just installed Serendipity and everything works fine, without the Directory-Things.
If i change to Media library i get the following Errors:

Code: Select all

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /is/htdocs/wp1006630_P3M3PRBB0R/www/start/include/functions_images.inc.php on line 1200
And if i go to the "Manage directories" i get:

Code: Select all

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /is/htdocs/wp1006630_P3M3PRBB0R/www/start/include/functions_images.inc.php on line 1200

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /is/htdocs/wp1006630_P3M3PRBB0R/www/start/include/functions_images.inc.php on line 1200

Warning: Invalid argument supplied for foreach() in /is/htdocs/wp1006630_P3M3PRBB0R/www/start/include/admin/images.inc.php on line 322
I created 2 Directories in the Upload-Folder: images and test, and they were created, but i cant access to them, and i cant delete them.

So first i download the newest Versions of funktions_images.inc.php and images.inc.php from the CVS, but with no improvement. I also read the Thread about the Directory Bug, but i have no Windows-System, its a shared Server under Linux.

Could someone help me to fix the Errors?
Thanks in advandce!
Bjoern

Re: Errors using "Manage directories"

Posted: Thu Mar 24, 2005 1:11 pm
by garvinhicking
It looks as if your hoster's safe mode or something is interfering.

Please open your include/functions_images.inc.php and replace the function serendipity_traversePath with this:

Code: Select all

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

    $dh = opendir($basedir . '/' . $dir);
    if ( !$dh ) {
        echo $basedir . '/' . $dir . ' could NOT be opened, see error message above! Aborting.<br />';
        return false;
    }

    $files = array();
    while (($file = @readdir($dh)) !== false) {
        if ( $file != '.' && $file != '..' ) {
            if ( $onlyDirs === true && is_dir($basedir . '/' . $dir . '/' . $file) ) {
                if ( is_null($pattern) || preg_match($pattern, $file) ) {
                    $files[] = array(
                        'name'    => $file, 
                        'depth'   => $depth, 
                        'relpath' => ltrim(str_replace('\\', '/', $dir) . basename($file) . '/', '/')
                    );
                }
            }
            if ( is_dir($basedir . '/' . $dir . '/' . $file) ) {
                $files = array_merge($files, serendipity_traversePath($basedir, $dir . '/' . basename($file) . '/', $onlyDirs, $pattern, ($depth+1)));
            }
        }
    }

    fclose($dh);
    return $files;
}
I added some verbose output to the top of the function, so please tell me what you get back.

Regards,
Garvin

Posted: Thu Mar 24, 2005 1:54 pm
by BjoernH
Hi Garvin!

Thanks for quick reply.
I get this back:

Code: Select all

Warning: opendir(/is/htdocs/wp1006630_P3M3PRBB0R/www/start/uploads///images/) [function.opendir]: failed to open dir: Permission denied in /is/htdocs/wp1006630_P3M3PRBB0R/www/start/include/functions_images.inc.php on line 1181
/is/htdocs/wp1006630_P3M3PRBB0R/www/start/uploads///images/ could NOT be opened, see error message above! Aborting.

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /is/htdocs/wp1006630_P3M3PRBB0R/www/start/include/functions_images.inc.php on line 1200

Warning: opendir(/is/htdocs/wp1006630_P3M3PRBB0R/www/start/uploads///test/) [function.opendir]: failed to open dir: Permission denied in /is/htdocs/wp1006630_P3M3PRBB0R/www/start/include/functions_images.inc.php on line 1181
/is/htdocs/wp1006630_P3M3PRBB0R/www/start/uploads///test/ could NOT be opened, see error message above! Aborting.

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /is/htdocs/wp1006630_P3M3PRBB0R/www/start/include/functions_images.inc.php on line 1200
Any idea?
Greetings
Bjoern

Posted: Thu Mar 24, 2005 2:23 pm
by garvinhicking
It only means that you have not set the dir to 777, so there is something wrong with your privilege setup. You should please ask your hoster with the error message you're getting.

Note that even though triple slashes like '///' may look wrong, the get automatically reduced to '/' on file access.

But you can also try this simple PHP script:

Code: Select all

<?php
$x = opendir('/is/htdocs/wp1006630_P3M3PRBB0R/www/start/uploads/images/');
?>
That should fail as well. If not, then the OS of your webserver is somewhat wicked. I'll need all your Path settings in the serendipity config section then, there might be something wrong then.

Regards,
Garvin

Posted: Thu Mar 24, 2005 2:31 pm
by BjoernH
Hi!

My upload-Directory has chmod 775 not 777. It was created by serendipity it self i guess with 775. I had to delete the upload-dir and re-created it with chmod 777.

But i still get a error, if i create sub-directories with s9y. Its the same error as above. Where can i change the chmod for s9y for creating directories?


Thanks!

Bjoern

Posted: Thu Mar 24, 2005 3:47 pm
by garvinhicking
That should never happen - if serendipity creates a directory, it should of course be able to write to it. If that is not the case, your webserver setup is really wicked - there should be no reason to change the chmod() of the code where serendipity creates a directory. Please contact your System administrator and ask what's going on :-)

Regards,
Garvin