h5p / moodle-mod_hvp

H5P Plugin for Moodle
GNU General Public License v3.0
131 stars 169 forks source link

Class name clash #347

Open sharpchi opened 4 years ago

sharpchi commented 4 years ago

I'm running Moodle 3.8 with this activity. Both core Moodle and this plugin have class names that clash. This can been seen when the look_for_updates task is run in mod_hvp.

... started 15:38:55. Current memory use 82.3MB.

Fatal error: Cannot declare interface H5PFileStorage, because the name is already in use in /var/www/html/moodle38/mod/hvp/library/h5p-file-storage.interface.php on line 10

Call Stack:
    0.0001     393600   1. {main}() /var/www/html/moodle38/admin/cli/cron.php:0
    0.1859   14006464   2. cron_run() /var/www/html/moodle38/admin/cli/cron.php:61
    0.3119   16014696   3. cron_run_scheduled_tasks() /var/www/html/moodle38/lib/cronlib.php:73
  513.6669   86362112   4. cron_run_inner_scheduled_task() /var/www/html/moodle38/lib/cronlib.php:119
  513.6676   86329104   5. mod_hvp\task\look_for_updates->execute() /var/www/html/moodle38/lib/cronlib.php:201
  513.6693   86567752   6. mod_hvp\framework::instance() /var/www/html/moodle38/mod/hvp/classes/task/look_for_updates.php:43
  513.6693   86567952   7. spl_autoload_call() /var/www/html/moodle38/mod/hvp/classes/framework.php:58
  513.6693   86567952   8. core_component::classloader() /var/www/html/moodle38/mod/hvp/classes/framework.php:58
  513.6701   86663368   9. include_once('/var/www/html/moodle38/mod/hvp/classes/file_storage.php') /var/www/html/moodle38/lib/classes/component.php:131
  513.6702   86676840  10. require_once('/var/www/html/moodle38/mod/hvp/library/h5p-file-storage.interface.php') /var/www/html/moodle38/mod/hvp/classes/file_storage.php:27

Perhaps the mod_hvp should namespace their classes to remove the clash. I guess the duplicate exists because h5p libraries are only in core since Moodle 3.8.

rezeau commented 4 years ago

Same error message when running CRON on a Moodle 3.9 instance: Fatal error: Cannot declare interface H5PFileStorage, because the name is already in use in /srv/data/web/vhosts/www.mydomainname.org/htdocs/moodle/mod/hvp/library/h5p-file-storage.interface.php on line 10

marinaglancy commented 4 years ago

Here is a cross-link with the same report on Moodle LMS side: https://tracker.moodle.org/browse/MDL-69415