Skip to content

Commit

Permalink
MDL-31006 some more PHP54 notices
Browse files Browse the repository at this point in the history
PHP54 compatibility - PhpStorm IDE is the best tool for this kind of work!!
  • Loading branch information
skodak authored and stronk7 committed Jan 18, 2012
1 parent b85b25e commit 9270102
Show file tree
Hide file tree
Showing 16 changed files with 27 additions and 10 deletions.
1 change: 1 addition & 0 deletions backup/restorelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ function restore_create_events($restore,$xml_file) {
}

//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']['#']);
Expand Down
2 changes: 1 addition & 1 deletion backup/util/helper/restore_decode_rule.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ protected function validate_params($linkname, $urltemplate, $mappings) {
$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);
Expand Down
1 change: 1 addition & 0 deletions course/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 7 additions & 2 deletions enrol/imsenterprise/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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]);
}
Expand All @@ -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)){
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/simpletest/fixtures/gradetest.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ function load_course_modules() {
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);
Expand Down
4 changes: 2 additions & 2 deletions message/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions mod/lesson/format.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions mod/lesson/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions mod/lesson/pagetypes/essay.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ public function stats(array &$pagestats, $tries) {
$essaystats->total++;
$pagestats[$temp->pageid] = $essaystats;
} else {
$essaystats = new stdClass();
$essaystats->totalscore = $essayinfo->score;
$essaystats->total = 1;
$pagestats[$temp->pageid] = $essaystats;
Expand Down Expand Up @@ -207,6 +208,7 @@ public function report_answers($answerpage, $answerdata, $useranswer, $pagestats
$answerdata->score = get_string("havenotgradedyet", "lesson");
}
} else {
$essayinfo = new stdClass();
$essayinfo->answer = get_string("didnotanswerquestion", "lesson");
}

Expand Down
1 change: 1 addition & 0 deletions mod/quiz/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ' .
Expand Down
1 change: 1 addition & 0 deletions mod/survey/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]." ";
}
Expand Down
1 change: 1 addition & 0 deletions question/behaviour/deferredcbm/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public function feedback(question_attempt $qa, question_display_options $options
}

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);
Expand Down
2 changes: 1 addition & 1 deletion question/engine/questionusage.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ public function render_question($slot, $options, $number = null) {
* @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();
}

Expand Down
2 changes: 1 addition & 1 deletion question/format/blackboard_six/format.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
}
Expand Down
2 changes: 2 additions & 0 deletions question/type/randomsamatch/questiontype.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@ public function get_question_options($question) {

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;
}
Expand Down
3 changes: 2 additions & 1 deletion webservice/simpletest/testwebservice.php
Original file line number Diff line number Diff line change
Expand Up @@ -866,8 +866,9 @@ function moodle_user_update_users($client) {

// 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);
Expand Down

0 comments on commit 9270102

Please sign in to comment.