CM Answers
[resolved] syntax error in AnswerController (2 posts)

  1. wajrou
    Posted 3 years ago #

    when I approve question (with non-auto-approve setting) in administration (CM Answer / Questions) the following error appears:

    Parse error: syntax error, unexpected 'Question' (T_STRING), expecting ',' or ';' in ...\wp-content\plugins\cm-answers\lib\controllers\AnswerController.php(34) : runtime-created function on line 1

    There are double quotes in sprintf(__()) passed to string which contain php code around these calls. The first double quote closes string for echo so there is missing correct escaping of double quotes after __() call.
    Error should be solved by adding addslashes(...) or strtr(..., array('"' => '\"')) or anything similar.

    add_action('admin_notices', create_function('$q', 'echo "<div class=\"updated\"><p>'.__('Question', 'cm-answers').': '.addslashes(sprintf(__('"%s" has been succesfully approved'), $thread->getTitle())).'</p></div>";'));

    Line 42 of AnswerController looks like containing same error.


  2. CM Plugins
    Plugin Author

    Posted 3 years ago #

    Thanks. Will release new version on Thursday with fix

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • CM Answers
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic