Skip to content

Commit

Permalink
PHP8.1 deprecation messages from preg_split and htmlspecialchars_decode
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusgreen committed May 14, 2023
1 parent 92ddf77 commit 6ac40b2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion questiontype.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ protected function initialise_question_instance(question_definition $question, $
$r = substr($question->delimitchars, 1, 1);

$nongapregex = '/\\' . $l . '.*?\\' . $r . '/';
$nongaptext = preg_split($nongapregex, $question->questiontext, null, PREG_SPLIT_DELIM_CAPTURE);
$nongaptext = preg_split($nongapregex, $question->questiontext, -1, PREG_SPLIT_DELIM_CAPTURE);
$i = 0;
while (!empty($nongaptext)) {
$question->textfragments[$i] = array_shift($nongaptext);
Expand Down
2 changes: 1 addition & 1 deletion renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public function embedded_element(question_attempt $qa, $place, question_display_
$question = $qa->get_question();
$fieldname = $question->field($place);

$currentanswer = $qa->get_last_qt_var($fieldname);
$currentanswer = $qa->get_last_qt_var($fieldname) ?? '';
$currentanswer = htmlspecialchars_decode($currentanswer);
$rightanswer = $question->get_right_choice_for($place);
$itemsettings = $this->get_itemsettings($rightanswer);
Expand Down

0 comments on commit 6ac40b2

Please sign in to comment.