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

Use original string hook callback definition for backwards compat. #812

Merged
merged 1 commit into from
May 1, 2024

Conversation

paulholden
Copy link
Contributor

See #809 - in order to support this hook from Moodle 4.3 we should use the simple callback format. Support for array callable notation arrived only in 4.4 (MDL-81180).

See catalyst#809 - in order to support this hook from Moodle 4.3 we should
use the simple callback format. Support for array callable notation
arrived only in 4.4 (MDL-81180).
@paulholden
Copy link
Contributor Author

To clarify, this is only the hook notation that needs to be updated, because when Moodle 4.3 attempts to read this hook definition in Moodle 4.3 the following is emitted:

debugging() message/s found: Hook callback definition contains invalid 'callback' string in 'auth_saml2'
line 536 of /lib/classes/hook/manager.php: call to debugging()
line 501 of /lib/classes/hook/manager.php: call to core\hook\manager->normalise_callback()
line ? of unknownfile: call to core\hook\manager->add_component_callbacks()
line 348 of /lib/classes/hook/manager.php: call to array_map()
line 328 of /lib/classes/hook/manager.php: call to core\hook\manager->load_callbacks()
line 75 of /lib/classes/hook/manager.php: call to core\hook\manager->init_standard_callbacks()
line 89 of /lib/classes/navigation/views/primary.php: call to core\hook\manager::get_instance()
line 907 of /lib/pagelib.php: call to core\navigation\views\primary->initialise()
line 967 of /lib/pagelib.php: call to moodle_page->magic_get_primarynav()
line 80 of /lib/classes/navigation/output/primary.php: call to moodle_page->__get()
line 58 of /lib/classes/navigation/output/primary.php: call to core\navigation\output\primary->get_primary_nav()
line 95 of /theme/workplace/layout/drawers.php: call to core\navigation\output\primary->export_for_template()
line 1486 of /lib/outputrenderers.php: call to include()
line 1412 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
line 116 of /index.php: call to core_renderer->header()

https://github.com/moodle/moodle/blob/MOODLE_403_STABLE/lib/classes/hook/manager.php#L534-L538

@@ -27,7 +27,7 @@
$callbacks = [
[
'hook' => \core\hook\output\before_http_headers::class,
'callback' => [auth_saml2\local\hooks\output\before_http_headers::class, 'callback'],
'callback' => 'auth_saml2\local\hooks\output\before_http_headers::callback',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gosh, that is true, thanks @paulholden. I knew that it is recent in fact, but did not take into account, oh shame shame.

@danmarsden danmarsden enabled auto-merge May 1, 2024 00:06
@danmarsden danmarsden merged commit 32302a8 into catalyst:MOODLE_39_STABLE May 1, 2024
2 checks passed
@paulholden paulholden deleted the hook-403 branch May 1, 2024 07:49
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.

3 participants