Habari media silo file upload not possible / blank media silo bar

4 views
Skip to first unread message

Peter David

unread,
May 30, 2010, 6:00:49 PM5/30/10
to habari-users
Hi everyone,
i had problems with the media silo and wrote a short fix for it.
i will cite from my blog pixtr.de
>>
When first installing habari 0.6.4., the media silo plugin did not
show anything except a black bar without any controls.
I tried setting the directory permissions for the user/files and user/
files/.deriv folders, but that brought no improvement.
Then I saw the error message "invalid argument supplied for foreach()
in /system/plugins/habarisilo/habarisilo.plugin.php 112" in the log
window.
Navigating through the file "/system/plugins/habarisilo/
habarisilo.plugin.php" brings up the following lines:
.
.
109) $dir = glob($this->root . ( $path == '' ? '' : '/' ) . $path . '/
*');
110)
111)
112) foreach ( $dir as $item ) {
.
.

The problem is, that line 109 sets the $dir variable to "false" when
the file dir is empty. And false is not a valid argument for
"foreach".
The bug is easily solved enclosing the code after line 112 by an if-
clause:

111) if($dir!=false) {
.
.
149) }

Hope it works for you!
>>

Greetings from Bremen, Germany,
Peter

michael.twofish

unread,
May 30, 2010, 6:59:12 PM5/30/10
to habari-users
On May 31, 8:00 am, Peter David <pd.ol...@googlemail.com> wrote:
> Hi everyone,
> i had problems with the media silo and wrote a short fix for it.
> i will cite from my blog pixtr.de

[snip]

> The problem is, that line 109 sets the $dir variable to "false" when
> the file dir is empty. And false is not a valid argument for
> "foreach".

Hi Peter,

Thanks for the bug report. This issue has actually been fixed in trunk
(r4035) by using Habari's Utils::glob(), which always returns an
array. Habari 0.7 will include this fix.

cheers, Michael

Reply all
Reply to author
Forward
0 new messages