Log in

View Full Version : Warning: array_merge() ERROR


tscbh
07-09-2005, 10:38 AM
I read through some of the similar error message from this forum, but I got a very weird problem. Yes, I am using vb 3.0.7 and running php5 under windows. The actually error message was:

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in \online.php on line 285;

When I first view who's online page, there is no error. 60 seconds later when WOL auto refresh I got that error message. Could any one tell me how I can fix this.

I follow the suggestion from Xenon(busy admin) https://vborg.vbsupport.ru/showthread.php?t=73945&highlight=array_merge%28%29+Argument

I put the following section of code on online.php before global.php is called, but I still get the same error message:

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();

// get special data templates from the datastore
$specialtemplates = array();

// pre-cache templates used by all actions
$globaltemplates = array();

// pre-cache templates used by specific actions
$actiontemplates = array();

If anyone have any suggestion, please let me know.
Thanks in advance.

Xenon
07-09-2005, 11:58 AM
can you post some lines around 285

it just means that ther secund argument isn't an array, maybe you ahve installed an hack, and the hack author didn't initialize the variables properly

tscbh
07-09-2005, 12:06 PM
Here are the line around 285 on the online.php file:

if (!$foundviewer AND $bbuserinfo['userid'] AND ($who == '' OR $who == 'members'))
{ // Viewing user did not show up so fake him
$userinfo["$bbuserinfo[userid]"] = $bbuserinfo;
$userinfo["$bbuserinfo[userid]"]['location'] = '/online.php';
$userinfo["$bbuserinfo[userid]"]['host'] = IPADDRESS;
$userinfo["$bbuserinfo[userid]"]['lastactivity'] = TIMENOW;
$userinfo["$bbuserinfo[userid]"]['joingroupid'] = iif($bbuserinfo['displaygroupid'] == 0, $bbuserinfo['usergroupid'], $bbuserinfo['displaygroupid']);
$userinfo["$bbuserinfo[userid]"]['musername'] = fetch_musername($userinfo["$bbuserinfo[userid]"], 'joingroupid');
$userinfo["$bbuserinfo[userid]"]['hidden'] = iif($bbuserinfo['invisible'], '*');
$userinfo["$bbuserinfo[userid]"]['invisible'] = 0;

[285] $userinfo[$bbuserinfo['userid']] = array_merge($userinfo["$bbuserinfo[userid]"] , construct_im_icons($userinfo["$bbuserinfo[userid]"]));
if ($vboptions['WOLresolve'] AND ($permissions['wolpermissions'] & CANWHOSONLINEIP))
{
$userinfo[$bbuserinfo['userid']]['host'] = @gethostbyaddr($userinfo["$bbuserinfo[userid]"]['host']);
}
}



I installed, vbStatistic, vbAdvance, referral statistic, ushop & ucash, paypal reoccuring payment. I am not sure if I got too much hacks installed!

Anyway, thanks for your help Xenon.

Xenon
07-09-2005, 12:13 PM
$userinfo[$bbuserinfo['userid']] = array_merge($userinfo["$bbuserinfo[userid]"] , construct_im_icons($userinfo["$bbuserinfo[userid]"]));

the array_merge is wrong here. construct_im_icons() doesn't return an array.

change the line into
construct_im_icons($userinfo); that should work then

tscbh
07-09-2005, 12:19 PM
Thanks so much Xenon, that's the quickest response I ever get. But I still get the same problem. I change to
$userinfo[$bbuserinfo['userid']] = array_merge($userinfo["$bbuserinfo[userid]"] , construct_im_icons($userinfo));
as you told me. It didn't work. Same problem!

Xenon
07-09-2005, 12:26 PM
you missunderstood my post.

you have to replace the complete line, not just that part ;)