v2.1.3 Book Module - Import from HTML does not work

v2.1.3 Book Module - Import from HTML does not work

by anthony curtis -
Number of replies: 1

Book Module - Import from HTML does not work.

When in ‘Update’ book

  • Use ‘Book Administration/Import from HTML’. In the ‘Import from HTML’ screen, select the ‘Choose a file…’ button to open the ‘File picker’. Select  the .zip to import , click the ‘Select this file’ and return to the ‘Import from HTML’ screen. Click ‘Import’ and receive the HTTP 500 error.
  • When I do the above steps with debug turned on, instead of a 500 error, I get the following:-

Warning: Uncaught exception 'coding_exception' with message 'Coding error detected, it must be fixed by a programmer: PHP catchable fatal error' in C:\inetpub\wwwroot\moodle\lib\setuplib.php:359 Stack trace: #0 [internal function]: default_error_handler(4096, 'Object of class...', 'C:\inetpub\wwwr...', 482, Array) #1 C:\inetpub\wwwroot\moodle\lib\textlib.class.php(482): asort(Array, 5) #2 C:\inetpub\wwwroot\moodle\mod\book\tool\importhtml\locallib.php(248): textlib->asort(Array) #3 C:\inetpub\wwwroot\moodle\mod\book\tool\importhtml\import_form.php(81): toolbook_importhtml_get_chapter_files(Object(stored_file), '2') #4 C:\inetpub\wwwroot\moodle\lib\formslib.php(499): booktool_importhtml_form->validation(Array, Array) #5 C:\inetpub\wwwroot\moodle\lib\formslib.php(448): moodleform->validate_defined_fields() #6 C:\inetpub\wwwroot\moodle\lib\formslib.php(545): moodleform->is_validated() #7 C:\inetpub\wwwroot\moodle\mod\book\tool\importhtml\index.php(70): moodleform->get_data() #8 {main} thrown in C:\inetpub\wwwroot\moodle\lib\setuplib.php on line 359 Fatal error: Object of class stdClass could not be converted to string in C:\inetpub\wwwroot\moodle\lib\textlib.class.php on line 482

  • My only option after the 500 error is to press the back button to return to the 'Import from HTML’ screen.

I am using v2.1.3 of moodle - and currently we cant upgrade to solve this problem - so it is not an option as a solution to fixing this problem. Moodle is on IIS, W2008, PHP.

I get this error / debug output regardless of how simple (i.e. 2 html files) the .zip file is. Does anyone know what could be causing this error and how it can be fixed without upgrading?

Average of ratings: -
In reply to anthony curtis

Re: v2.1.3 Book Module - Import from HTML does not work

by Frances McIlwaine -

Hi Anthony,

We are using 2.2.11 so don't know if this solution will work for you too. I also was having problems importing HTML files however have now successfully done so by doing the following:

  • Put each separate chapter/HTML file into its own folder and zip the folder
  • Click on 'Import from HTML' and for Type use the drop-down menu to choose "Each directory represents one chapter"
  • Choose and upload your single zipped chapter and click import

Hope it's also successful for you smile

Frances