The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> PHP Development
|
PHP5 - PHP 5.4.0 Illegal String offset warning
Discuss PHP 5.4.0 Illegal String offset warning in the PHP Development forum on Dev Shed. PHP 5.4.0 Illegal String offset warning PHP Development forum discussing coding practices, tips on PHP, and other PHP-related topics. PHP is an open source scripting language that has taken the web development industry by storm.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

January 10th, 2013, 07:48 PM
|
|
Contributing User
|
|
Join Date: Dec 2012
Location: Ithaca
Posts: 64
Time spent in forums: 13 h 8 m 5 sec
Reputation Power: 1
|
|
|
PHP5 - PHP 5.4.0 Illegal String offset warning
Well I upgraded to PHP 5.4 and my vbulletin forum is showing this warning.
Quote: | Warning: Illegal string offset 'do' in [path]/includes/functions_online.php on line 458 |
I was wondering though, is there a way to suppress illegal string offset warning in PHP 5.4? Just curious.
|

January 10th, 2013, 08:04 PM
|
 |
Still alive
|
|
Join Date: Mar 2007
Location: Washington, USA
|
|
|
As far as I can tell, vBulletin doesn't support PHP 5.4.
|

January 10th, 2013, 08:06 PM
|
|
Contributing User
|
|
Join Date: Dec 2012
Location: Ithaca
Posts: 64
Time spent in forums: 13 h 8 m 5 sec
Reputation Power: 1
|
|
Quote: | Originally Posted by requinix As far as I can tell, vBulletin doesn't support PHP 5.4. |
Yeah I know of that, I have been trying to fix the incompatibilities. I was able to resolve the ampersand symbol error, the forum actually works pretty well right now. I do not get any fatal errors, just some annoying warnings like this one.
|

January 10th, 2013, 08:39 PM
|
 |
Still alive
|
|
Join Date: Mar 2007
Location: Washington, USA
|
|
If you're willing to fix code then try the form
PHP Code:
$string[is_string($string) ? intval($offset) : $offset]
(because I have to assume that under some conditions $string is actually an array)
If $offset is a hardcoded string then you can do away with the intval() and simply
PHP Code:
$string[is_string($string) ? 0 : "do"]
|

January 10th, 2013, 08:48 PM
|
|
Contributing User
|
|
Join Date: Dec 2012
Location: Ithaca
Posts: 64
Time spent in forums: 13 h 8 m 5 sec
Reputation Power: 1
|
|
This is where the warning message is generated, so yeah the variable is an array. The $userinfo['values']['do'] is what causing the problem. Interestingly, the warning message is only generated when an online user is viewing PM box.
PHP Code:
case 'pm':
$userinfo['action'] = $vbphrase['private_messaging'];
if ($vbulletin->userinfo['permissions']['wolpermissions'] & $vbulletin->bf_ugp_wolpermissions['canwhosonlinefull'])
{
if ($seeuserid)
{
$userinfo['where'] = '<a href="member.php?' . $vbulletin->session->vars['sessionurl'] . "u=$seeuserid\">$wol_user[$seeuserid]</a>";
}
if ($userinfo['values']['do'] == 'newpm' OR $userinfo['values']['do'] == 'insertpm' OR $userinfo['values']['do'] == 'newmessage')
{
$userinfo['action'] = $vbphrase['creating_private_message'];
}
else if ($userinfo['values']['do'] == 'editfolders' OR $userinfo['action']['do'] == 'updatefolders')
{
$userinfo['action'] = $vbphrase['modifying_private_message_folders'];
}
else if ($userinfo['values']['do'] == 'trackpm' OR $userinfo['values']['do'] == 'deletepmreceipt')
{
$userinfo['action'] = $vbphrase['tracking_private_messages'];
}
else if ($userinfo['values']['do'] == 'showpm')
{
$userinfo['action'] = $vbphrase['viewing_private_message'];
}
else if ($userinfo['values']['do'] == 'downloadpm')
{
$userinfo['action'] = $vbphrase['downloading_private_messages'];
}
}
break;
|

January 10th, 2013, 09:41 PM
|
 |
Still alive
|
|
Join Date: Mar 2007
Location: Washington, USA
|
|
|
The code clearly expects $userinfo['values'] to be an array but apparently isn't in that case. So what is its value?
|

January 10th, 2013, 09:43 PM
|
|
Contributing User
|
|
Join Date: Dec 2012
Location: Ithaca
Posts: 64
Time spent in forums: 13 h 8 m 5 sec
Reputation Power: 1
|
|
|
I am not quite sure, but it seems to me that it is null. Weird though...
|

May 11th, 2013, 11:30 AM
|
|
Registered User
|
|
Join Date: May 2013
Posts: 1
Time spent in forums: 2 m
Reputation Power: 0
|
|
|
I think it's a bug in that code and must read $userinfo['values']['do'] == 'updatefolders' instead of $userinfo['action']['do'] == 'updatefolders'
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|