Small error with guest questions

monkeyman
monkeyman
  • monkeyman
  • 10 months ago
If question was asked by guest, then if you try to add an answer to it, you'll get an error:

Warning: array_merge(): Argument #1 is not an array in /components/com_communityanswers/controllers/answers.php on line 522

Here's a code:



if($question->created_by == 0){

$asker = new stdClass();
$asker->name = $question->username;
$asker->email = $question->email;
$asker->subid = 0;

$admins = array_merge($asker, $admins);
}


Clearly $asker here is an object, not array. This is why error occurs. Changing to this fixes the problem:

$admins = array_merge(array($asker), $admins);

Access to viewing replies is restricted.
Showing 1 of 1 replies
You do not have permissions for replying to this topic.
Loading...
Confirm delete? This action is irreversible and the data will be deleted permanently. Do you want to continue? Confirm Add New Delete Unpublish Cancel Import Uninstall The selected item successfully deleted.
Shondalai