moodle-an-hochschulen / moodle-local_staticpage

Moodle plugin which displays static information pages which exist outside any course, imprint or faq pages for example, complete with Moodle navigation and theme
GNU General Public License v3.0
46 stars 28 forks source link

Warning: DOMDocument::loadHTML() #60

Closed lillybud closed 2 years ago

lillybud commented 3 years ago

Hi,

We have upgraded moodle to 3.11 and use latest available Static Pages version which is 2021010901 or 3.10. PHP is 7.2. Linux Ubuntu 20 machine

After uploading html file, the file is rendered as it should be, but we get 4 lines of warning on top of static page:

_Warning: DOMDocument::loadHTML(): ID kolumn30 already defined in Entity, line: 90 in /<...>moodle_path/local/staticpage/view.php on line 83

Warning: DOMDocument::loadHTML(): ID kolumn10 already defined in Entity, line: 92 in /<...>moodle_path/local/staticpage/view.php on line 83

Warning: DOMDocument::loadHTML(): ID kolumn10 already defined in Entity, line: 93 in /<...>moodle_path/local/staticpage/view.php on line 83

Warning: DOMDocument::loadHTML(): ID kolumn10 already defined in Entity, line: 94 in/<...>moodlepath/local/staticpage/view.php on line 83

Would be good to have an option to hide warnings before owner has opportunity to fix HTML code in static page.

abias commented 2 years ago

Hi @lillybud ,

two things are important here in my point of view:

  1. These are PHP warnings. They are only shown in the browser if Moodle debugging is enabled. As you shouldn't have debugging enabled in production (or at least you shouldn't have debug messages shown in the browser in production), this shouldn't be a real problem.
  2. There are HTML errors in the uploaded HTML document and the DOM parser is right to complain about them.

To me, this problem should be fixed at its origin (in the HTML document). If would be wrong to suppress these warnings within the plugin, regardless if this suppression is configurable in the plugin or not.

I hope you can agree with me.

Cheers, Alex