PDA

View Full Version : ksort() expects parameter 1 to be array, boolean given in showgroups.php on line 143



Fli
08-07-2024, 06:07 PM
Issue:

vBulletin 4.x warning/error..

PHP Warning: ksort() expects parameter 1 to be array, boolean given in showgroups.php on line 143\n
PHP Warning: Invalid argument supplied for foreach() in showgroups.php on line 144\n

Possible fix:

replace:


$usergroups = '';
if (sizeof($groupcache) >= 1)
{
ksort($groupcache); // alphabetically sort usergroups
foreach ($groupcache AS $users)
{

by:

$usergroups = '';
if (is_array($groupcache) && sizeof($groupcache) >= 1)
{
ksort($groupcache); // alphabetically sort usergroups
foreach ($groupcache as $users)
{


There was also warning: PHP Strict Standards: Only variables should be assigned by reference in includes/class_dm_threadpost.php line 113, but i have only muted it by adding to the second line (after line <?php) this:
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);
This code line tells PHP to report all types of errors except for notices (E_NOTICE) and strict standards (E_STRICT).