MDL-78147 h5p: Added class properties that are not declared

In PHP 8.2 and later, setting a value to an undeclared class property is
deprecated and emits a deprecation notice.
So we need to add missing class properties that still need to be declared.
This commit is contained in:
Meirza 2023-06-07 05:16:57 +07:00
parent 84bb5725f8
commit 1c2a86c335
6 changed files with 34 additions and 2 deletions

View File

@ -679,6 +679,7 @@ interface H5PFrameworkInterface {
class H5PValidator {
public $h5pF;
public $h5pC;
public $h5pCV;
// Schemas used to validate the h5p files
private $h5pRequired = array(
@ -2134,6 +2135,21 @@ class H5PCore {
self::DISABLE_COPYRIGHT => self::DISPLAY_OPTION_COPYRIGHT
);
/** @var string To file storage directory. */
public $url;
/** @var int evelopment mode. */
public $development_mode;
/** @var bool aggregated files for assets. */
public $aggregateAssets;
/** @var string full path of plugin. */
protected $fullPluginPath;
/** @var string regex for converting copied files paths. */
public $relativePathRegExp;
/**
* Constructor for the H5PCore
*
@ -4155,6 +4171,9 @@ class H5PContentValidator {
private $typeMap, $libraries, $dependencies, $nextWeight;
private static $allowed_styleable_tags = array('span', 'p', 'div','h1','h2','h3', 'td');
/** @var bool Allowed styles status. */
protected $allowedStyles;
/**
* Constructor for the H5PContentValidator
*

View File

@ -50,3 +50,9 @@ instance, if a new method is added to h5p-file-storage.interface.php, it should
// End of Moodle patch.
var options = {
Notes:
* 2023-05-10 To avoid PHP 8.2 deprecations, please apply below patches:
- https://github.com/h5p/h5p-php-library/pull/146
- https://github.com/h5p/h5p-php-library/pull/148
See MDL-78147 for more details.

View File

@ -9,7 +9,7 @@ use stdClass;
*/
class H5peditorFile {
private $result, $field, $interface;
public $type, $name, $path, $mime, $size;
public $type, $name, $path, $mime, $size, $extension;
/**
* Constructor. Process data for file uploaded through the editor.

View File

@ -55,7 +55,7 @@ class H5peditor {
'ckeditor/ckeditor.js',
);
private $h5p, $storage;
public $ajax, $ajaxInterface;
public $ajax, $ajaxInterface, $content;
/**
* Constructor for the core editor library.

View File

@ -33,3 +33,7 @@ Changed:
* Edit language/en.js and remove the content for 'filters' (it's a JSON with several fields, such as level or language).
* If https://github.com/h5p/h5p-editor-php-library/pull/148 hasn't been merged, a patch needs to be added in
h5p/h5plib/v124/joubel/editor/h5peditor-file.class.php, to replace FILTER_SANITIZE_STRING to FILTER_SANITIZE_FULL_SPECIAL_CHARS.
Notes:
* 2023-05-10 Applied patch https://github.com/h5p/h5p-editor-php-library/pull/169 to avoid PHP 8.2 deprecations.
See MDL-78147 for more details.

View File

@ -40,6 +40,9 @@ defined('MOODLE_INTERNAL') || die();
*/
class h5p_core_test extends \advanced_testcase {
/** @var core */
protected $core;
protected function setUp(): void {
global $CFG;
parent::setUp();