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

Apply sensible default values for $CFG if not specified #185

Merged
merged 1 commit into from
Feb 16, 2022

Conversation

andrewnicols
Copy link
Contributor

In order to use the core_component functions, sensible defaults are
required.

These sensible defaults are available, but the check of $CFG->dirroot
when $CFG is empty lead to a php warning, causing phpcs failures.

Even if this error is fixed, the default values in $CFG are then set to
NULL after including core_component, which means that uses of it work
with null values and cause require errors.

Fixes #184

In order to use the core_component functions, sensible defaults are
required.

These sensible defaults are available, but the check of `$CFG->dirroot`
when $CFG is empty lead to a php warning, causing phpcs failures.

Even if this error is fixed, the default values in $CFG are then set to
NULL after including core_component, which means that uses of it work
with null values and cause require errors.

Fixes moodlehq#184
@stronk7 stronk7 merged commit c3350d2 into moodlehq:master Feb 16, 2022
@stronk7
Copy link
Member

stronk7 commented Feb 16, 2022

Merged, thanks!

I really don't know what I was thinking with the final implementation that landed few days ago.

I remember I did lot of attempts (from the original one, cloning the whole CFG to restiitute it later... to that one, only modifying the smallest possible set of variables.

But obviously, the final logic was flawed when not using the standard within a moodle installation.

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

Successfully merging this pull request may close these issues.

Revisit some illogical code from #183
2 participants