Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
891 views
in Plugins by

Hi everyone,

I'm using Infinity theme and plugin for Q2A site. When I edit a anwser or comment, error happend at top of page as quoted below (edit question is no problem).

I know this error come from Infinity plugin because when I disable it, error dissapear.

Please can anyone help. I want to use this full theme Infinity, dont't want another. Thanks in anvandce.

Warning: array_slice() expects parameter 1 to be array, null given in D:\WWW\wordpress\qa\qa-include\qa-base.php(595) : eval()'d code on line 83
Warning: array_slice() expects parameter 1 to be array, null given in D:\WWW\wordpress\qa\qa-include\qa-base.php(595) : eval()'d code on line 85
Warning: array_merge(): Argument #1 is not an array in D:\WWW\wordpress\qa\qa-include\qa-base.php(595) : eval()'d code on line 86
Warning: array_slice() expects parameter 1 to be array, null given in D:\WWW\wordpress\qa\qa-include\qa-base.php(595) : eval()'d code on line 130
Warning: array_slice() expects parameter 1 to be array, null given in D:\WWW\wordpress\qa\qa-include\qa-base.php(595) : eval()'d code on line 132
Warning: array_merge(): Argument #1 is not an array in D:\WWW\wordpress\qa\qa-include\qa-base.php(595) : eval()'d code on line 133

1 Answer

+2 votes
by
selected by
 
Best answer

I've just forked the project and fixed the error. Here is the Github link: https://github.com/pupi1985/Q2A-Infinity-Theme

You can either download the fixed version or apply the changes of the last commit to yours.

by
I couldn't reproduce the issue you mention. Can you please tell me the steps you performed after installing Q2A from scratch in order to reproduce the issue here and find a fix? That would simplify fixing the issue.

Make sure to use this version https://github.com/pupi1985/Q2A-Infinity-Theme/archive/master.zip (I've changed a small thing but should be unrelated I think).

You could also add some debug information in file qa-plugin/Infinity-Plugin/it-layer.php, right before this line:

$count = count($this->content[$form_name]["fields"]);

Add these lines:

if (!isset($this->content[$form_name])) {
    error_log('Template: ' . $this->template);
    error_log('Request: ' . $this->request);
    error_log('Is POST: ' . qa_is_http_post() ? 'true' : 'false');
    foreach ($this->content as $key => $e) {
        error_log('[' . $key . '] => '. print_r($e, 1));
    }
}

That should give a lot of information in the logs.
by
Sure here are the steps to reproduce the issue.

1- Install q2a from stratch.
2- Install infinity theme.
3- Click ask a question button without logging in. (as an anonymous user)

You may see the problem live here:

http://zayifakim.org/sorular2/ask

I also used the code from github repository.

Here is the error log:

http://pasted.co/858da780

Step to fix problem:

1- Simply  delete Infinity-Plugin in  plugins directory.
by
Well, that was not exactly what I asked for but it actually hit the nail. Being logged out was the key to reproduce this.  Please, redownload, test, and report back. Thanks.
by
The problem seems to be solved. Thanks.
...