ElkArte Community

Elk Development => Bug Reports => Exterminated Bugs => Topic started by: AaronB on March 22, 2014, 08:57:29 am

Title: Manage Membergroups fatal error on Members.subs.php
Post by: AaronB on March 22, 2014, 08:57:29 am
In the Manage Membergroups>Group Members>Add a member to this group; when a member is added the following error is generated

Fatal error: [] operator not supported for strings in /home/elkarte/public_html/sources/subs/Members.subs.php on line 1475

That error is from a live test site, with the beta install package and with the master package files copied over.

If the site has only the beta install package, the error is on line 1432. The Members.subs.php error is reproduceable on both a live test site and an Xampp localhost.
Title: Re: Manage Membergroups fatal error on Members.subs.php
Post by: emanuele on March 22, 2014, 11:06:11 am
One of the stupid error of mines... :-[

Instead of this:
Code: [Select]
				foreach ($query_conditions as $condition => $query_condition)
{
if ($query_condition == 'member_names')
$query_parts[$condition === 'or' ? 'or' : 'and'] = $allowed_conditions[$query_condition]($query_params);
else
$query_parts[$condition === 'or' ? 'or' : 'and'] = isset($allowed_conditions[$query_condition]) ? $allowed_conditions[$query_condition] : $query_condition;
}
}
elseif ($query == 'member_names')
$query_parts[$condition === 'or' ? 'or' : 'and'] = $allowed_conditions[$query]($query_params);
else
$query_parts['and'] = isset($allowed_conditions[$query]) ? $allowed_conditions[$query] : $query;
}

try this:
Code: [Select]
				foreach ($query_conditions as $condition => $query_condition)
{
if ($query_condition == 'member_names')
$query_parts[$condition === 'or' ? 'or' : 'and'][] = $allowed_conditions[$query_condition]($query_params);
else
$query_parts[$condition === 'or' ? 'or' : 'and'][] = isset($allowed_conditions[$query_condition]) ? $allowed_conditions[$query_condition] : $query_condition;
}
}
elseif ($query == 'member_names')
$query_parts[$condition === 'or' ? 'or' : 'and'][] = $allowed_conditions[$query]($query_params);
else
$query_parts['and'][] = isset($allowed_conditions[$query]) ? $allowed_conditions[$query] : $query;
}

There are two blocks of code to replace!

If it works, I pushed the fix here:
https://github.com/emanuele45/Dialogo/commit/e2640745814340050c7024d5ab2d1d76b088b94f