Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+4 votes
533 views
in Q2A Core by

Looks like I've found a bug. Steps to reproduce:

1. Although it seems to be failing with any module, for convenience, open the qa-plugin/basic-adsense/qa-basic-adsense.php file

2. Add the following function to it:

function load_module($directory$urltoroot$type$name) {
    
error_log('111');
    
qa_opt('a');  // Make sure this option title is NOT in the DB
    
error_log('222');
}

3. Go to the plugins page
 
The page breaks with an HTTP 500 error. The log results:
 
[... too many "111" outputs... over a hundred in my case ...]
[Sun Jan 12 23:48:18 2014] [error] [client 127.0.0.1] 111, referer: http://localhost/admin/general
[Sun Jan 12 23:48:18 2014] [error] [client 127.0.0.1] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 91 bytes) in /my-local-path/site/qa-include/qa-app-options.php on line 219, referer: http://localhost/admin/general
 
So it seems there is some kind of loop going on there that is triggering the loading of modules. What would be the appropriate way of creating a ticket for this bug? I see no BUG category and no way to report it using github.

 

Q2A version: 1.6.2
by
Could it be that error_log() does not work correctly in the load_module function? Just don't use it :)
by
Poor error_log. When everybody has left me aside in the debugging process, he has been there for me :) And no, it is not the error_log. I believe the qa_opt is calling the load_module and, in turn, the load_module is calling the qa_opt. There must be some kind of condition not being checked in this process. Note the init_queries method does get properly called and no infinite loop happens in there.
by
This is like specifications of Q2A not bug. However, I am troubled with this problem very much, too. This produces even that we call qa_opt() from CONSTRUCTOR function of the plugin. I think this is a most big defect when we make plugin of Q2A.
by
Do you think it is slowing down the page build?
by
This matter is potential problem (coding limit) from old days. Therefore I think that it is not cause of slowing down of this site.

1 Answer

+2 votes
by

I answered on Github: https://github.com/q2a/question2answer/issues/22

In short: don't use qa_opt inside load_module. Sorry.

by
You should not apologize. As far as I'm concerned, I should be taking a closer look at the issue and send you a pull request. It's me who should be sorry for not doing so :)
...