WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. wajrou
    Member
    Posted 1 year ago #

    Hi,
    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.

    E.g.:
    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.

    http://wordpress.org/extend/plugins/cm-answers/

  2. CM Plugins
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks. Will release new version on Thursday with fix

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic