I've looked into this and I see where the problem is. This is definitely
going to be a bug and it's going to be due to your system returning FALSE
instead of an empty array.

Further up on the file where the first array_map() takes place, we can see
this behaviour is accounted for:

---
                // For each directory, save the available files in the
$files array.
                foreach ($dirs as $dir) {
                        $glob = glob( $dir . '/classes/*.php' );
                        if ( $glob === false || empty( $glob ) )
continue;    <<---- HERE
                        $fnames = array_map(create_function('$a', 'return
strtolower(basename($a));'), $glob);
                        $files = array_merge($files, array_combine($fnames,
$glob));
                }
---

But the same check is not done further down at the next array_map().

I'll log a ticket and let you know the number.


On Sun, Nov 30, 2008 at 12:18 PM, Colin <[EMAIL PROTECTED]> wrote:

> Looks like your system has either had a problem with the glob() hence it
> returning FALSE, or it's one of the few systems that fall into this comment
> that appears on the php.net/glob page:
>
> *Note*: On some systems it is impossible to distinguish between empty
> match and an error.
>
> Change your Util::debug() line to read: Utils::debug( $site_user_dir); and
> refresh.  This is likely to return something like:
>
> */var/www/web234/html/florianfiegel/home/user/sites/
> blog.florian-fiegel.net/*
>
> Check all the directories in the path returned from /home onward and ensure
> your webserver user has access to each directory in the path.
>
> It is does, then I think your system may be one of those that returns FALSE
> instead of an empty array.
>
> You may find changing the $fnames line to read (add the "(array)" part
> before $glob):
>
>          $fnames = array_map(create_function('$a', 'return
> strtolower(basename($a));'), (array)$glob);
>
> ... will stop the errors and allow things to work correctly.
>
> If so, let me know and I'll log a bug for this behaviour.
>
>
>
>
> On Sun, Nov 30, 2008 at 11:53 AM, Fiegel Florian <
> [EMAIL PROTECTED]> wrote:
>
>>  When I add the Utils I get:
>>
>> Call Stack
>> >
>> index.php (113): spl_autoload_call(stringError);
>> [Internal PHP] (): __autoload(stringError);
>> index.php (91): Utils::debug(boolean);
>>
>> boolean
>>
>> The logs are clean, even with the optional error backtrace logging
>> enabled.
>>
>>
>> Am 30.11.2008 um 12:36 schrieb Colin:
>>
>> Thanks.
>>
>> It sounds like your system may be having problems with glob() not
>> returning an array, even an empty one.
>>
>> I suspect the line number in the error may be slightly wrong as line 91 is
>> a comment.  There are two array_map function calls in index.php and I
>> suspect you're tripping up on the 2nd.
>>
>> Add "Utils::debug($glob);" just above the $fnames line so the if() clause
>> looks like this:
>>
>> ---
>>                 // Verify if this Habari instance is a multisite.
>>                 if ( ($site_user_dir = Site::get_dir('user')) !=
>> HABARI_PATH . '/user' ) {
>>                         // We are dealing with a site defined in
>> /user/sites/x.y.z
>>                         // Add the available files in that directory in
>> the $files array.
>>                         $glob = glob( $site_user_dir . '/classes/*.php' );
>>                         Utils::debug($glob);     //
>> <<<<<------------------- HERE
>>                         $fnames = array_map(create_function('$a', 'return
>> strtolower(basename($a));'), $glob);
>>                         if ( $glob !== false && ! empty( $glob ) && !
>> empty( $fnames ) ) {
>>                                 $files = array_merge($files,
>> array_combine($fnames, $glob));
>>                         }
>>                 }
>> ---
>>
>> ... and refresh your page.  What is displayed now?
>>
>> It's also worth checking your error logs. Is anything else printed in them
>> around this warning?
>>
>>
>>
>> On Sun, Nov 30, 2008 at 11:09 AM, Fiegel Florian <
>> [EMAIL PROTECTED]> wrote:
>>
>>>   Actually i'm using the last 0.6-alpha (head), updated before asking
>>> here. I thougt it maybe was a bug and already fixed.
>>>
>>> Am 30.11.2008 um 11:25 schrieb Colin:
>>>
>>> Hmmm, so that's not it (best put those permissions back).
>>>
>>> What version of Habari are you using?
>>>
>>>
>>> On Sun, Nov 30, 2008 at 10:05 AM, Florian Fiegel <
>>> [EMAIL PROTECTED]> wrote:
>>>
>>>>
>>>> Hi,
>>>>
>>>> so, I now set 777 to the folders and the warning resides on the top of
>>>> the page.
>>>>
>>>> The site is displayed and works, so there is no bigger problem. Just
>>>> this annoying warning on every page.
>>>>
>>>> If you want to check out: http://blog.florian-fiegel.net
>>>>
>>>> regards
>>>> Florian
>>>>
>>>> On 30 Nov., 09:45, Colin <[EMAIL PROTECTED]> wrote:
>>>> > Hi there
>>>> >
>>>> > Sounds like you may not have sufficient access permissions on your
>>>> > /path/to/habari/user/sites directory or it's sub-directories.
>>>> >
>>>> > Ensure this directory is accessible by your web server user.
>>>> >
>>>> > HTH
>>>> > Colin
>>>> >
>>>> > On Fri, Nov 28, 2008 at 5:36 PM, Florian Fiegel <
>>>> >
>>>> >
>>>> >
>>>> > [EMAIL PROTECTED]> wrote:
>>>> >
>>>> > > Hi out there,
>>>> >
>>>> > > I am not sure if it is a bug, but when using Multisite I get this
>>>> > > warning every time:
>>>> >
>>>> > > Warning: array_map() [function.array-map]: Argument #2 should be an
>>>> > > array in /var/www/.../index.php on line 91
>>>> >
>>>> > > I actually use 0.6-alpha. If there is a need to more specs, just
>>>> tell
>>>> > > me.
>>>> >
>>>> > > It is caused by anything I did? Or is it really a bug?
>>>> > > Couldn't find anything in the wiki or on Trac, so I am unsure.
>>>> >
>>>> > > Regards
>>>> > > Florian
>>>> >
>>>> > --
>>>> > Colin Seymour
>>>> > Blog:http://www.colinseymour.co.uk
>>>> > Tech Stuff:http://www.lildude.co.uk
>>>>
>>>>
>>>
>>>
>>> --
>>> Colin Seymour
>>> Blog: http://www.colinseymour.co.uk
>>> Tech Stuff: http://www.lildude.co.uk
>>>
>>>
>>> Tech Stuff: http://www.lildude.co.uk
>>>
>>>
>>> >>>
>>>
>>
>
>
> --
> Colin Seymour
> Blog: http://www.colinseymour.co.uk
> Tech Stuff: http://www.lildude.co.uk
>
>


-- 
Colin Seymour
Blog: http://www.colinseymour.co.uk
Tech Stuff: http://www.lildude.co.uk

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/habari-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to