PDA

View Full Version : Warning: Illegal string offset 'do' in [path]/includes/functions_online.php on line 5


pjkcards
07-27-2014, 12:15 PM
I'm running vB 4.2.1, PHP version 5.4.30 MySQL version 5.6.16, and just noticed when I go here:
[removed for now]

I get the above error. How can I resolve this? I just noticed this today.

Thanks.

ozzy47
07-27-2014, 12:20 PM
Does the same thing happen with all mods disabled?

ForceHSS
07-27-2014, 12:29 PM
Check error_log in ftp root

kh99
07-27-2014, 12:39 PM
What do you have at the beginning of file includes/functions_online.php? That's a strange error because there's nothing near line 5 that should be doing that, unless someone has added some code to the beginning.

tbworld
07-27-2014, 05:35 PM
All the above suggestions are very worthwhile and I could not agree more with @KH99. Usually, that error occurs in php 5.4 with the slight strengthening of data-type checking. Typically in vbulletin it is because we are sending a string, when we are asking for an array, or vice-versa. In most cases you just suppress the warning.

If you are using php v5.4 you should be using vb4.2.2, as vb4.2.1 was never vetted for PHP v5.4, by vBulletin.

Check your logs and investigate why PHP is reporting an improper line number as @KH99 suggested.

:)

pjkcards
07-28-2014, 09:29 AM
Thanks for the info guys. I was about to test with the mods off, but the error isn't coming up no more. No idea why. Any ideas why this would be?

The top of the includes/functions_online.php file looks like:

<?php
/*================================================= =====================*\
|| ################################################## ################## ||
|| # vBulletin 4.2.1 - Licence Number VBFXXXXXXX
|| # ---------------------------------------------------------------- # ||
|| # Copyright ?2000-2013 vBulletin Solutions Inc. All Rights Reserved. ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
|| ################################################## ################## ||
\*================================================ ======================*/

// ###################### Start userlocation #######################
function fetch_user_location_array($userinfo)
{

global $vbulletin;

$datecut = TIMENOW - $vbulletin->options['cookietimeout'];

if (($userinfo['invisible'] == 0 OR $userinfo['userid'] == $vbulletin->userinfo['userid'] OR $vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canseehidden']) AND // Check if user is hidden
$vbulletin->options['WOLenable'] AND // Is WOL enabled?
($vbulletin->userinfo['permissions']['wolpermissions'] & $vbulletin->bf_ugp_wolpermissions['canwhosonline']) AND // Does viewing user have WOL access?
($userinfo['lastactivity'] > $datecut AND $userinfo['lastvisit'] != $userinfo['lastactivity']) AND // Is user actually online?
$location = $vbulletin->db->query_first("SELECT location, badlocation FROM " . TABLE_PREFIX . "session WHERE userid = $userinfo[userid] AND lastactivity > $datecut ORDER BY lastactivity DESC LIMIT 1"))
{

$userinfo['location'] = $location['location'];
$userinfo['badlocation'] = $location['badlocation'];
$userinfo = process_online_location($userinfo);
convert_ids_to_titles();
$userinfo = construct_online_bit($userinfo);
}

return $userinfo;
}

Does that look normal?

As for PHP 5.4, I read that 4.2.1 was compatible with "PHP version 5.2.0 or greater" (https://www.vbulletin.com/docs/html?manualversion=40201601). Is this not correct?

ozzy47
07-28-2014, 09:35 AM
You should edit that post and remove your license number from the code. No need to post that on public.

kh99
07-28-2014, 11:24 AM
Does that look normal?

That looks right to me. I guess I just don't understand the error message.

Also, I edited your post to remove the license number.

Lynne
07-28-2014, 04:37 PM
vB4.2.1 is not compatible with PHP5.4, only vB4.2.2 (and above) is compatible with PHP5.4.

pjkcards
07-29-2014, 04:41 AM
Thanks for editing that out, my mistake.

vB4.2.1 is not compatible with PHP5.4, only vB4.2.2 (and above) is compatible with PHP5.4.
Why does it show in the manual it is compatible with it (see the link I posted above). I will work on upgrading to 4.2.2, please update the manual to show this so others don't upgrade thinking it is compatible.

I won't be able to do the upgrade for a week or two. Will there be any issues if I wait this long or should I make the upgrade more urgent? Thanks.

AusPhotography
07-29-2014, 04:46 AM
You must use vB4.2.2 for PHP 5.4 and vB4.2.3 (beta) with PHP 5.5

Lynne
07-29-2014, 03:39 PM
When you upgrade to 4.2.2, you will want to add a line to your config.php file. As of vBulletin 4.2.2, notices and warnings are no longer suppressed by default like in previous versions of the software. This means that on some servers, you may see warnings that you never saw before. In order to stop them from showing, please add the following line to your config.php file under the <?php line:


define('SKIP_ALL_ERRORS', true);

pjkcards
07-31-2014, 12:21 AM
I'll upgrade to 4.2.2 now. Is it compatible with MySQL version 5.6.16?

Thanks.

Lynne
07-31-2014, 12:50 AM
Yes. The MySQL version isn't a problem with the software.