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

Allowed globals is incomplete? #181

Open
jrchamp opened this issue Aug 22, 2024 · 1 comment · May be fixed by #182
Open

Allowed globals is incomplete? #181

jrchamp opened this issue Aug 22, 2024 · 1 comment · May be fixed by #182

Comments

@jrchamp
Copy link
Contributor

jrchamp commented Aug 22, 2024

In short, the $FULLSCRIPT global is missing from the list of allowed variable names.

As of August 22, 2024, here are the allowed globals:

public static $allowedglobals = ['ADMIN', 'CFG', 'COURSE', 'DB', 'FULLME',
'OUTPUT', 'PAGE', 'PERF', 'SESSION', 'SITE', 'THEME', 'USER',
'_SERVER', '_GET', '_POST', '_FILES', '_REQUEST', '_SESSION', '_ENV',
'_COOKIE', '_HTTP_RAW_POST_DATA', 'ACCESSLIB_PRIVATE', 'ME',
'CONDITIONLIB_PRIVATE', 'FILTERLIB_PRIVATE', 'SCRIPT', 'MNET_REMOTE_CLIENT',
'http_response_header'];

While I see the PHP superglobals ($_GET, $_POST, etc.) and the main Moodle global objects ($CFG, $DB, $USER, etc.) there are a few Moodle global literals like $ME, $FULLME, $SCRIPT that are present.

Today was my first day seeing those literals, because I was looking for origin of $FULLSCRIPT. I don't know the difference between the four and I don't see any uses in core of $FULLSCRIPT outside of it being defined and initialized. Someone else didn't know, so they incorrectly lowercased the variable thinking that it was a plugin-specific variable, which may have caused some issues.

@jrchamp
Copy link
Contributor Author

jrchamp commented Aug 22, 2024

Side note: If any of the Moodle globals are "deprecated" or there are better options, documentation would be really helpful. ❤️

@jrchamp jrchamp linked a pull request Aug 29, 2024 that will close this issue
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 a pull request may close this issue.

1 participant