Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

MDL-29339 Manually cast objects to string before calling dmllib.

  • Loading branch information...
commit 8c7d6037e6514fb40a2fe776edc552e1d2e0e100 1 parent e04dba0
Tim Hunt authored October 24, 2011

Showing 1 changed file with 11 additions and 10 deletions. Show diff stats Hide diff stats

  1. 21  question/engine/datalib.php
21  question/engine/datalib.php
@@ -111,7 +111,7 @@ public function insert_question_attempt_step(question_attempt_step $step,
111 111
         $record = new stdClass();
112 112
         $record->questionattemptid = $questionattemptid;
113 113
         $record->sequencenumber = $seq;
114  
-        $record->state = '' . $step->get_state();
  114
+        $record->state = (string) $step->get_state();
115 115
         $record->fraction = $step->get_fraction();
116 116
         $record->timecreated = $step->get_timecreated();
117 117
         $record->userid = $step->get_user_id();
@@ -505,14 +505,14 @@ public function load_average_marks(qubaid_condition $qubaids, $slots = null) {
505 505
         }
506 506
 
507 507
         list($statetest, $stateparams) = $this->db->get_in_or_equal(array(
508  
-                question_state::$gaveup,
509  
-                question_state::$gradedwrong,
510  
-                question_state::$gradedpartial,
511  
-                question_state::$gradedright,
512  
-                question_state::$mangaveup,
513  
-                question_state::$mangrwrong,
514  
-                question_state::$mangrpartial,
515  
-                question_state::$mangrright), SQL_PARAMS_NAMED, 'st');
  508
+                (string) question_state::$gaveup,
  509
+                (string) question_state::$gradedwrong,
  510
+                (string) question_state::$gradedpartial,
  511
+                (string) question_state::$gradedright,
  512
+                (string) question_state::$mangaveup,
  513
+                (string) question_state::$mangrwrong,
  514
+                (string) question_state::$mangrpartial,
  515
+                (string) question_state::$mangrright), SQL_PARAMS_NAMED, 'st');
516 516
 
517 517
         return $this->db->get_records_sql("
518 518
 SELECT
@@ -818,7 +818,8 @@ protected function full_states_to_summary_state_sql() {
818 818
      */
819 819
     public function in_summary_state_test($summarystate, $equal = true, $prefix = 'summarystates') {
820 820
         $states = question_state::get_all_for_summary_state($summarystate);
821  
-        return $this->db->get_in_or_equal($states, SQL_PARAMS_NAMED, $prefix, $equal);
  821
+        return $this->db->get_in_or_equal(array_map('strval', $states),
  822
+                SQL_PARAMS_NAMED, $prefix, $equal);
822 823
     }
823 824
 
824 825
     /**

0 notes on commit 8c7d603

Please sign in to comment.
Something went wrong with that request. Please try again.