partridgejiang / Kekule.js

A Javascript cheminformatics toolkit.
http://partridgejiang.github.io/Kekule.js
MIT License
248 stars 61 forks source link

Kekuleloader filter in Moodle 4.00rc1 #276

Closed registerme1963 closed 2 years ago

registerme1963 commented 2 years ago

I was testing kekulejs with Moodle 4.0rc1 (Build: 20220408). This throws the following error:

This page did not call $PAGE->set_url(...). Using http://moodlesite/admin/search.php line 674 of /lib/pagelib.php: call to debugging() line 953 of /lib/pagelib.php: call to moodle_page->magic_get_url() line 15 of /filter/kekuleloader/filter.php: call to moodle_page->get() line 291 of /lib/filterlib.php: call to filter_kekuleloader->setup() line 1714 of /lib/pagelib.php: call to filter_manager->setup_page_for_globally_available_filters() line 1979 of /lib/setuplib.php: call to moodle_page->initialise_theme_and_output() line 36 of /mod/quiz/accessrule/seb/settings.php: call to bootstrap_renderer->call() line 309 of /mod/quiz/settings.php: call to include() line 140 of /lib/classes/plugininfo/mod.php: call to include() line 47 of /admin/settings/plugins.php: call to core\plugininfo\mod->load_settings() line 8925 of /lib/adminlib.php: call to require() line 8804 of /lib/adminlib.php: call to admin_get_root() line 28 of /admin/search.php: call to admin_externalpage_setup()

(works well in Moodle v3.11.6)

partridgejiang commented 2 years ago

Just tested in Moodle 4.0rc1 for a while and found that the error messages were evoked in certain pages (e.g. /admin/search.php) of Moodle. I guess it is the bug of 4.0, perhaps in the initialization codes of those pages, $page->_url field is not properly set? A modification of /filter/kekuleloader/filter.php may workaround the issue. Just change line 15-16 to the following codes:

$needApply = true;
$url = '';
if (!empty($page->_url))
  $url = $page->url;

However, that is not a elegant solution. Will keep on tests with new rc release of Moodle 4.0 later.