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

I upgraded to Q2A 1.4.1 (from 1.3) and on every question I get the error: 

Fatal error: Call to a member function get_html() on a non-object in /[my q2a path]/qa-include/qa-app-format.php on line 306

I did have this problem with the upgrade but fixed it and everything else went smoothly. The list of questions on the home page displays fine and the admin section works. Just individual Q's don't work.

UPDATE: after a little dive into the code I found it's because I had a completely fresh install and my Markdown plugin was missing. In other words, if a post is registered as the "markdown" format, Q2A breaks if there is no viewer for that format and doesn't fall back to the basic text viewer.

Patch

Between lines 304 and 306, add
if ( $viewer===null )
    $viewer=qa_load_viewer($post['content'], '');

Between lines 1343 and 1344, add
if ( $viewer===null )
    $viewer=qa_load_viewer($content, '');

I think that takes care of it.

1 Answer

0 votes
by
Thanks for the heads up - in the next maintenance release I'll make it show an explanation on the actual page, rather than throwing a PHP error.
by
I think you should still display the content though. What happens if I want to remove the Markdown plugin? I'd have to go into the database and change the format of every post.
by
Seems like a bit of a security concern to output the content column if the format is not recognized - this could really contain anything, since its format is defined only by the editor/viewer plugin.
by
Yes I suppose you're right. Not sure if there is a good solution to this. I guess we can just leave it as is and see if in the future anyone decides they want to completely remove a plugin.
...