MDL-31006 some more PHP54 notices
PHP54 compatibility - PhpStorm IDE is the best tool for this kind of work!!
This commit is contained in:
committed by
Eloy Lafuente (stronk7)
parent
b85b25ebb8
commit
927010240f
@@ -461,6 +461,7 @@
|
||||
}
|
||||
|
||||
//Now build the EVENT record structure
|
||||
$eve = new stdClass();
|
||||
$eve->name = backup_todb($info['EVENT']['#']['NAME']['0']['#']);
|
||||
$eve->description = backup_todb($info['EVENT']['#']['DESCRIPTION']['0']['#']);
|
||||
$eve->format = backup_todb($info['EVENT']['#']['FORMAT']['0']['#']);
|
||||
|
||||
@@ -151,7 +151,7 @@ class restore_decode_rule {
|
||||
$countma = count($mappings);
|
||||
// Check mappings number matches placeholders
|
||||
if ($countph != $countma) {
|
||||
$msg = new stdclass();
|
||||
$a = new stdClass();
|
||||
$a->placeholders = $countph;
|
||||
$a->mappings = $countma;
|
||||
throw new restore_decode_rule_exception('decode_rule_mappings_incorrect_count', $a);
|
||||
|
||||
@@ -150,6 +150,7 @@ function build_mnet_logs_array($hostid, $course, $user=0, $date=0, $order="l.tim
|
||||
$groupid = 0;
|
||||
|
||||
$joins = array();
|
||||
$where = '';
|
||||
|
||||
$qry = "SELECT l.*, u.firstname, u.lastname, u.picture
|
||||
FROM {mnet_log} l
|
||||
|
||||
@@ -590,6 +590,8 @@ function process_membership_tag($tagcontents){
|
||||
// In order to reduce the number of db queries required, group name/id associations are cached in this array:
|
||||
$groupids = array();
|
||||
|
||||
$ship = new stdClass();
|
||||
|
||||
if(preg_match('{<sourcedid>.*?<id>(.+?)</id>.*?</sourcedid>}is', $tagcontents, $matches)){
|
||||
$ship->coursecode = ($truncatecoursecodes > 0)
|
||||
? substr(trim($matches[1]), 0, intval($truncatecoursecodes))
|
||||
@@ -601,8 +603,8 @@ function process_membership_tag($tagcontents){
|
||||
$courseobj->id = $ship->courseid;
|
||||
|
||||
foreach($membermatches as $mmatch){
|
||||
unset($member);
|
||||
unset($memberstoreobj);
|
||||
$member = new stdClass();
|
||||
$memberstoreobj = new stdClass();
|
||||
if(preg_match('{<sourcedid>.*?<id>(.+?)</id>.*?</sourcedid>}is', $mmatch[1], $matches)){
|
||||
$member->idnumber = trim($matches[1]);
|
||||
}
|
||||
@@ -622,6 +624,7 @@ function process_membership_tag($tagcontents){
|
||||
//echo "<p>process_membership_tag: unenrolling member due to recstatus of 3</p>";
|
||||
}
|
||||
|
||||
$timeframe = new stdClass();
|
||||
$timeframe->begin = 0;
|
||||
$timeframe->end = 0;
|
||||
if(preg_match('{<role\b.*?<timeframe>(.+?)</timeframe>.*?</role>}is', $mmatch[1], $matches)){
|
||||
@@ -680,6 +683,7 @@ function process_membership_tag($tagcontents){
|
||||
$groupids[$member->groupname] = $groupid; // Store ID in cache
|
||||
} else {
|
||||
// Attempt to create the group
|
||||
$group = new stdClass();
|
||||
$group->name = $member->groupname;
|
||||
$group->courseid = $ship->courseid;
|
||||
$group->timecreated = time();
|
||||
@@ -752,6 +756,7 @@ function log_line($string){
|
||||
* Process the INNER contents of a <timeframe> tag, to return beginning/ending dates.
|
||||
*/
|
||||
function decode_timeframe($string){ // Pass me the INNER CONTENTS of a <timeframe> tag - beginning and/or ending is returned, in unix time, zero indicating not specified
|
||||
$ret = new stdClass();
|
||||
$ret->begin = $ret->end = 0;
|
||||
// Explanatory note: The matching will ONLY match if the attribute restrict="1"
|
||||
// because otherwise the time markers should be ignored (participation should be
|
||||
|
||||
@@ -291,6 +291,7 @@ class grade_test extends UnitTestCaseUsingDatabase {
|
||||
global $DB;
|
||||
$course_module = new stdClass();
|
||||
$course_module->course = $this->courseid;
|
||||
$quiz = new stdClass();
|
||||
$quiz->module = 1;
|
||||
$quiz->instance = 2;
|
||||
$course_module->id = $DB->insert_record('course_modules', $course_module);
|
||||
|
||||
+2
-2
@@ -948,7 +948,7 @@ function message_add_contact($contactid, $blocked=0) {
|
||||
|
||||
} else {
|
||||
/// new contact record
|
||||
unset($contact);
|
||||
$contact = new stdClass();
|
||||
$contact->userid = $USER->id;
|
||||
$contact->contactid = $contactid;
|
||||
$contact->blocked = $blocked;
|
||||
@@ -1648,7 +1648,7 @@ function message_search($searchterms, $fromme=true, $tome=true, $courseid='none'
|
||||
|
||||
/// The keys may be duplicated in $m_read and $m_unread so we can't
|
||||
/// do a simple concatenation
|
||||
$message = array();
|
||||
$messages = array();
|
||||
foreach ($m_read as $m) {
|
||||
$messages[] = $m;
|
||||
}
|
||||
|
||||
@@ -158,6 +158,7 @@ function lesson_save_question_options($question, $lesson) {
|
||||
case LESSON_PAGE_TRUEFALSE:
|
||||
|
||||
// the truth
|
||||
$answer = new stdClass();
|
||||
$answer->lessonid = $question->lessonid;
|
||||
$answer->pageid = $question->id;
|
||||
$answer->timecreated = $timenow;
|
||||
|
||||
+2
-2
@@ -171,9 +171,9 @@ function lesson_user_outline($course, $user, $mod, $lesson) {
|
||||
//if grade was last modified by the user themselves use date graded. Otherwise use date submitted
|
||||
//TODO: move this copied & pasted code somewhere in the grades API. See MDL-26704
|
||||
if ($grade->usermodified == $user->id || empty($grade->datesubmitted)) {
|
||||
$result->time = $grade->dategraded;
|
||||
$return->time = $grade->dategraded;
|
||||
} else {
|
||||
$result->time = $grade->datesubmitted;
|
||||
$return->time = $grade->datesubmitted;
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
|
||||
@@ -166,6 +166,7 @@ class lesson_page_type_essay extends lesson_page {
|
||||
$essaystats->total++;
|
||||
$pagestats[$temp->pageid] = $essaystats;
|
||||
} else {
|
||||
$essaystats = new stdClass();
|
||||
$essaystats->totalscore = $essayinfo->score;
|
||||
$essaystats->total = 1;
|
||||
$pagestats[$temp->pageid] = $essaystats;
|
||||
@@ -207,6 +208,7 @@ class lesson_page_type_essay extends lesson_page {
|
||||
$answerdata->score = get_string("havenotgradedyet", "lesson");
|
||||
}
|
||||
} else {
|
||||
$essayinfo = new stdClass();
|
||||
$essayinfo->answer = get_string("didnotanswerquestion", "lesson");
|
||||
}
|
||||
|
||||
|
||||
@@ -1444,6 +1444,7 @@ function quiz_num_attempt_summary($quiz, $cm, $returnzero = false, $currentgroup
|
||||
$numattempts = $DB->count_records('quiz_attempts', array('quiz'=> $quiz->id, 'preview'=>0));
|
||||
if ($numattempts || $returnzero) {
|
||||
if (groups_get_activity_groupmode($cm)) {
|
||||
$a = new stdClass();
|
||||
$a->total = $numattempts;
|
||||
if ($currentgroup) {
|
||||
$a->group = $DB->count_records_sql('SELECT COUNT(DISTINCT qa.id) FROM ' .
|
||||
|
||||
@@ -511,6 +511,7 @@ function survey_get_template_name($templateid) {
|
||||
*/
|
||||
function survey_shorten_name ($name, $numwords) {
|
||||
$words = explode(" ", $name);
|
||||
$output = '';
|
||||
for ($i=0; $i < $numwords; $i++) {
|
||||
$output .= $words[$i]." ";
|
||||
}
|
||||
|
||||
@@ -88,6 +88,7 @@ class qbehaviour_deferredcbm_renderer extends qbehaviour_renderer {
|
||||
}
|
||||
|
||||
if ($options->marks >= question_display_options::MARK_AND_MAX) {
|
||||
$a = new stdClass();
|
||||
$a->rawmark = format_float($qa->get_last_behaviour_var('_rawfraction') *
|
||||
$qa->get_max_mark(), $options->markdp);
|
||||
$a->mark = $qa->format_mark($options->markdp);
|
||||
|
||||
@@ -354,7 +354,7 @@ class question_usage_by_activity {
|
||||
* @return string HTML fragment.
|
||||
*/
|
||||
public function render_question_head_html($slot) {
|
||||
$options->context = $this->context;
|
||||
//$options->context = $this->context;
|
||||
return $this->get_question_attempt($slot)->render_head_html();
|
||||
}
|
||||
|
||||
|
||||
@@ -507,7 +507,7 @@ function process_responses($bb_responses, &$responses) {
|
||||
//Added this line to instantiate $response.
|
||||
// Without instantiating the $response variable, the same object
|
||||
// gets added to the array
|
||||
$response = null;
|
||||
$response = new stdClass();
|
||||
if (isset($bb_response['@']['title'])) {
|
||||
$response->title = $bb_response['@']['title'];
|
||||
}
|
||||
|
||||
@@ -62,10 +62,12 @@ class qtype_randomsamatch extends question_type {
|
||||
|
||||
public function save_question_options($question) {
|
||||
global $DB;
|
||||
$options = new stdClass();
|
||||
$options->question = $question->id;
|
||||
$options->choose = $question->choose;
|
||||
|
||||
if (2 > $question->choose) {
|
||||
$result = new stdClass();
|
||||
$result->error = "At least two shortanswer questions need to be chosen!";
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -866,8 +866,9 @@ class webservice_test extends UnitTestCase {
|
||||
|
||||
// custom fields
|
||||
if(!empty($user1->customfields)) {
|
||||
$customuser1 = new stdClass();
|
||||
$customuser1->id = $user1->id;
|
||||
foreach($user1->customfields as $customfield) {
|
||||
$customuser1->id = $user1->id;
|
||||
$customuser1->{"profile_field_".$customfield['type']} = $customfield['value'];
|
||||
}
|
||||
profile_save_data((object) $customuser1);
|
||||
|
||||
Reference in New Issue
Block a user