Permalink
Browse files

MDL-17995 replacing is_null() by empty(). Merged from HEAD

  • Loading branch information...
1 parent eb64eef commit 3c6ed6e2caf29455a3da3e345b13dccc0d34faf5 pichetp committed Jan 26, 2009
Showing with 11 additions and 11 deletions.
  1. +11 −11 question/type/multianswer/questiontype.php
@@ -85,7 +85,7 @@ function save_question_options($question) {
}
$sequence = array();
foreach($question->options->questions as $wrapped) {
- if (!is_null($wrapped)){
+ if (!empty($wrapped)){
// if we still have some old wrapped question ids, reuse the next of them
if (is_array($oldwrappedquestions) && $oldwrappedquestion = array_shift($oldwrappedquestions)) {
@@ -222,17 +222,17 @@ function get_correct_responses(&$question, &$state) {
global $QTYPES;
$responses = array();
foreach($question->options->questions as $key => $wrapped) {
- if (!is_null($wrapped)){
- if ($correct = $QTYPES[$wrapped->qtype]->get_correct_responses($wrapped, $state)) {
- $responses[$key] = $correct[''];
- } else {
- // if there is no correct answer to this subquestion then there
- // can not be a correct answer to the whole question either, so
- // we have to return null.
- return null;
+ if ( !empty($wrapped)){
+ if ($correct = $QTYPES[$wrapped->qtype]->get_correct_responses($wrapped, $state)) {
+ $responses[$key] = $correct[''];
+ } else {
+ // if there is no correct answer to this subquestion then there
+ // can not be a correct answer to the whole question either, so
+ // we have to return null.
+ return null;
+ }
}
}
- }
return $responses;
}
@@ -568,7 +568,7 @@ function grade_responses(&$question, &$state, $cmoptions) {
$teststate = clone($state);
$state->raw_grade = 0;
foreach($question->options->questions as $key => $wrapped) {
- if (!is_null($wrapped)){
+ if (!empty($wrapped)){
$state->responses[$key] = $state->responses[$key];
$teststate->responses = array('' => $state->responses[$key]);
$teststate->raw_grade = 0;

0 comments on commit 3c6ed6e

Please sign in to comment.