Skip to content

Commit 284e686

Browse files
Fix PHP8.2: Deprecated: Creation of dynamic property errors (#189)
* For testing, updated ci workflow to install fixed CR adaptive plugin * Fix grunt failures * Update CI workflow to include PHP8.2 * Fix PHP8.2: Deprecated: Creation of dynamic property errors
1 parent 7241a07 commit 284e686

21 files changed

+394
-23
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ jobs:
99
fail-fast: false
1010
matrix:
1111
include:
12+
- php: '8.2'
13+
moodle-branch: 'master'
14+
database: 'pgsql'
15+
- php: '8.1'
16+
moodle-branch: 'MOODLE_403_STABLE'
17+
database: 'mariadb'
1218
- php: '8.0'
1319
moodle-branch: 'MOODLE_402_STABLE'
1420
database: 'pgsql'
@@ -30,7 +36,7 @@ jobs:
3036
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
3137

3238
mariadb:
33-
image: mariadb:10.5
39+
image: mariadb:10.6
3440
env:
3541
MYSQL_USER: 'root'
3642
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
@@ -83,7 +89,7 @@ jobs:
8389
8490
- name: Install Moodle
8591
run: |
86-
moodle-plugin-ci add-plugin trampgeek/moodle-qbehaviour_adaptive_adapted_for_coderunner
92+
moodle-plugin-ci add-plugin --branch wip753140_adaptive AnupamaSarjoshi/moodle-qbehaviour_adaptive_adapted_for_coderunner
8793
moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1
8894
moodle-plugin-ci add-config 'define("QTYPE_CODERUNNER_JOBE_HOST", "localhost:4000");'
8995
env:

amd/build/ajaxquestionloader.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

amd/build/ajaxquestionloader.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

classes/combinator_grader_outcome.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,28 @@
2525
use qtype_coderunner\constants;
2626

2727
class qtype_coderunner_combinator_grader_outcome extends qtype_coderunner_testing_outcome {
28+
29+
/** @var ?string Html that is displayed before the result table. */
30+
public $epiloguehtml;
31+
32+
/** @var ?string Html that is displayed after the result table. */
33+
public $prologuehtml;
34+
35+
/** @var array */
36+
public $columnformats;
37+
38+
/** @var bool If true, the question does not display the result table and no grading. */
39+
public $outputonly;
40+
41+
/** @var ?string HTML feedback set for teacher that is hidden from student. */
42+
public $instructorhtml;
43+
44+
/** @var ?number The grade, out of 1. */
45+
public $fraction;
46+
47+
/** @var bool If true, is used when the question is to be used only to display the output and perhaps images from a run, with no mark. */
48+
public $showoutputonly;
49+
2850
// A list of the allowed attributes in the combinator template grader return value.
2951
public $allowedfields = ['fraction', 'prologuehtml', 'testresults', 'epiloguehtml',
3052
'feedbackhtml', 'columnformats', 'showdifferences',

classes/display_options.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
// This file is part of CodeRunner - http://coderunner.org.nz/
3+
//
4+
// CodeRunner is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// CodeRunner is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU General Public License
15+
// along with CodeRunner. If not, see <http://www.gnu.org/licenses/>.
16+
17+
namespace qtype_coderunner;
18+
19+
defined('MOODLE_INTERNAL') || die();
20+
require_once($CFG->dirroot . '/question/engine/lib.php');
21+
22+
/**
23+
* An extension of question_display_options that includes the extra options used by the coderunner.
24+
*
25+
* @package qtype_coderunner
26+
* @copyright 2024 The Open University
27+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
28+
*/
29+
class display_options extends \question_display_options {
30+
31+
/**
32+
* @var bool
33+
*/
34+
public $suppressruntestslink = false;
35+
}

classes/html_wrapper.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
*/
2424

2525
class qtype_coderunner_html_wrapper {
26+
27+
/** @var string */
28+
private $html;
29+
2630
public function __construct($html) {
2731
$this->html = $html;
2832
}

classes/jobesandbox.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ class qtype_coderunner_jobesandbox extends qtype_coderunner_sandbox {
5757
private $httpcode = null; // HTTP response code.
5858
private $response = null; // Response from HTTP request to server.
5959

60+
/** @var mixed Jobe server host name. */
61+
private $jobeserver;
62+
63+
/** @var mixed Jobe server API-key. */
64+
private $apikey;
65+
6066
// Constructor gets languages from Jobe and stores them.
6167
// If $this->languages is left null, the Jobe server is down or
6268
// refusing requests or misconfigured. The actual HTTP returncode and response

classes/jobrunner.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,18 @@ class qtype_coderunner_jobrunner {
3636
private $testcases = null; // The testcases (a subset of those in the question).
3737
private $allruns = null; // Array of the source code for all runs.
3838

39+
/** @var ?array Array of sandbox params. */
40+
private $sandboxparams = null;
41+
42+
/** @var ?string Language used to run the code. */
43+
private $language = null;
44+
45+
/** @var ?array An associative array of template params.*/
46+
private $templateparams = null;
47+
48+
/** @var bool True if this grading is occurring because the student clicked the precheck button. */
49+
private $isprecheck = false;
50+
3951
// Check the correctness of a student's code and possible extra attachments
4052
// as an answer to the given
4153
// question and and a given set of test cases (which may be empty or a

classes/sandbox.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ abstract class qtype_coderunner_sandbox {
9090

9191

9292

93-
public function __construct($user = null, $pass = null) {
93+
public function __construct($user = null, $password = null) {
9494
$this->user = $user;
95-
$this->pass = $pass;
95+
$this->password = $password;
9696
$this->authenticationerror = false;
9797
}
9898

classes/student.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,25 @@
2424
*/
2525

2626
class qtype_coderunner_student {
27+
28+
/** @var int */
29+
public $id;
30+
31+
/** @var string */
2732
public $username;
33+
34+
/** @var string */
2835
public $email;
36+
37+
/** @var string */
2938
public $firstname;
39+
40+
/** @var string */
3041
public $lastname;
3142

43+
/** @var bool Whether the user can view hidden test cases. */
44+
public $canviewhidden;
45+
3246
public function __construct($user) {
3347
if (!empty($user->username)) {
3448
$this->id = $user->id;

0 commit comments

Comments
 (0)