Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing property initialization for $type->type in "function mod_game_get_course_content_items_type" in lib.php #67

Closed
NJahreis opened this issue Apr 16, 2024 · 1 comment

Comments

@NJahreis
Copy link
Contributor

NJahreis commented Apr 16, 2024

The deletion of the following line

$type->type = "game&type=".$kind;
in lib.php by commit bb7ef29 leads to the following PHP warning as the property "type" of the stdClass object is no longer initialized:

Got error 'PHP message: 
PHP Warning:  Undefined property: stdClass::$type in /moodle/apache2/htdocs/mod/game/lib.php on line 1248PHP message:
PHP Warning:  Undefined property: stdClass::$type in /moodle/apache2/htdocs/mod/game/lib.php on line 1248PHP message:
PHP Warning:  Undefined property: stdClass::$type in /moodle/apache2/htdocs/mod/game/lib.php on line 1248PHP message:
PHP Warning:  Undefined property: stdClass::$type in /moodle/apache2/htdocs/mod/game/lib.php on line 1248PHP message:
PHP Warning:  Undefined property: stdClass::$type in /moodle/apache2/htdocs/mod/game/lib.php on line 1248PHP message:
PHP Warning:  Undefined property: stdClass::$type in /moodle/apache2/htdocs/mod/game/lib.php on line 1248PHP message:
PHP Warning:  Undefined property: stdClass::$type in /moodle/apache2/htdocs/mod/game/lib.php on line 1248PHP message:
PHP Warning:  Undefined property: stdClass::$type in /moodle/apache2/htdocs/mod/game/lib.php on line 1248', referer: https://MYMMOODLE.de/course/view.php?id=MYCOURSEID

This propably also has further consequences as the call to 'preg_replace('/.*type=/', '', $type->type);' thus is performed on the undefined property and '$type->name' wont be correctly set. I just noticed the error in my log files and have not looked into the effects this has.

I would assume the deletion of the line was by accident and the issue can be fixed by re introducing the line.

@bdaloukas
Copy link
Owner

Thank you. I merged it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants