Moodle

print_error does not allow more than one parameter ($a) in the string

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Cannot Reproduce
  • Affects Version/s: 2.0
  • Fix Version/s: None
  • Component/s: General
  • Labels:
    None
  • Affected Branches:
    MOODLE_20_STABLE

Description

Trying to put an error message using qtype_multianswer.php with 2 parameters
$string['unknownquestiontypeofsubquestion'] = 'Unknown question type: $a->type of question part # $a->sub';
with the following code
$a = new stdClass;
$a->type = 'multichoice' ;
$a->sub = "1";
echo "<p>".get_string('unknownquestiontypeofsubquestion', 'qtype_multianswer',$a)."</p>";
print_error('unknownquestiontypeofsubquestion', 'qtype_multianswer',$a);
the echo get_string is Ok but the print_error has an error from weblib. see the screenshot to be attached

Activity

Hide
Petr Škoda (skodak) added a comment -

hi,
print_error() does not use the same number of parameters, you skipped one of them

print_error ($errorcode, $module='', $link='', $a=NULL)

Show
Petr Škoda (skodak) added a comment - hi, print_error() does not use the same number of parameters, you skipped one of them print_error ($errorcode, $module='', $link='', $a=NULL)
Hide
Pierre Pichet added a comment -

Thanks and sorry for the trouble, I didn't notice the ,'', in a similar print_error() call put recently (19 may) in the same file by Dongsheng Chai

Show
Pierre Pichet added a comment - Thanks and sorry for the trouble, I didn't notice the ,'', in a similar print_error() call put recently (19 may) in the same file by Dongsheng Chai
Hide
Andrew Davis added a comment -

Argument fixes to the calls to print_error in question/type/multianswer/questiontype.php in both 1.9 and 2 verified. closing.

Show
Andrew Davis added a comment - Argument fixes to the calls to print_error in question/type/multianswer/questiontype.php in both 1.9 and 2 verified. closing.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: