Moodle

Fatal error when attempting to import questions

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 2.0
  • Fix Version/s: 1.9.6, 2.0
  • Component/s: Questions
  • Labels:
    None
  • Affected Branches:
    MOODLE_20_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE, MOODLE_20_STABLE

Description

Simply login as an admin, browse to a course, select questions from the navigation, and then choose import and `wallah` you should see this fatal error.
The function as it suggests is declared in both files and both files have been included, I'm not too familiar with this side of things and at a quick glace of the under lying code I figured this would be a better left for someone who has some knowledge of this area. If no one claims it however I'll take it.

Fatal error: Cannot redeclare hotpot_utf8_to_html_entity()
(previously declared in /var/www/m20.dev1/moodle/mod/hotpot/lib.php:2793) in /var/www/m20.dev1/moodle/question/format/hotpot/format.php on line 673

  1. Time Memory Function Location
    1 0.0103 192992 {main}( ) ../import.php:0
    2 0.2502 50423264 moodleform->moodleform( ) ../import.php:48
    3 0.2513 50443480 question_import_form->definition( ) ../formslib.php:149
    4 0.2524 50673384 get_import_export_formats( ) ../import_form.php:16

Issue Links

Activity

Hide
Sam Hemelryk added a comment -

Just noticed that it also does it on export.php but not quite so spectacular

Show
Sam Hemelryk added a comment - Just noticed that it also does it on export.php but not quite so spectacular
Hide
Tim Hunt added a comment -

This must he a side effect of a recent change by Howard and Gordon. I think it happened in the stable branch too. I will look into it later today.

Show
Tim Hunt added a comment - This must he a side effect of a recent change by Howard and Gordon. I think it happened in the stable branch too. I will look into it later today.
Hide
Tim Hunt added a comment -

Fixed.

I have to say, whoever it was who copied and pasted large chunks of code from mod/hotpot/lib.php rather than using require_once has me very worried.

Show
Tim Hunt added a comment - Fixed. I have to say, whoever it was who copied and pasted large chunks of code from mod/hotpot/lib.php rather than using require_once has me very worried.
Hide
Tim Hunt added a comment -

By the way, I don't have any hotpot files to use to test this. Please can someone else do it.

Show
Tim Hunt added a comment - By the way, I don't have any hotpot files to use to test this. Please can someone else do it.
Hide
Gordon Bateson added a comment -

> By the way, I don't have any hotpot files to use to test this.
> Please can someone else do it.

Please do not commit untested changes to stable versions of Moodle. Your most recent commit has broken HotPot import on Moodle 1.9. It was working fine, but now it does not. I will try to fix it later on today if I have time.

You have me very worried ... I have to say

Show
Gordon Bateson added a comment - > By the way, I don't have any hotpot files to use to test this. > Please can someone else do it. Please do not commit untested changes to stable versions of Moodle. Your most recent commit has broken HotPot import on Moodle 1.9. It was working fine, but now it does not. I will try to fix it later on today if I have time. You have me very worried ... I have to say
Hide
Tim Hunt added a comment -

Well, my commit un-broke import and export in every other file format - both the import and export pages were giving fatal errors before.

If you attach a suitable file here, I am happy to test it.

Show
Tim Hunt added a comment - Well, my commit un-broke import and export in every other file format - both the import and export pages were giving fatal errors before. If you attach a suitable file here, I am happy to test it.
Hide
Gordon Bateson added a comment -

> Well, my commit un-broke import and export in every other file format
> both the import and export pages were giving fatal errors before

Ah, you are talking about Moodle 2.0. I am talking about stable version of Moodle, i.e. Moodle 1.9. That was not broken and but it is now. I would like to undo your "fix" on Moodle 1.9. Would that be OK?

Show
Gordon Bateson added a comment - > Well, my commit un-broke import and export in every other file format > both the import and export pages were giving fatal errors before Ah, you are talking about Moodle 2.0. I am talking about stable version of Moodle, i.e. Moodle 1.9. That was not broken and but it is now. I would like to undo your "fix" on Moodle 1.9. Would that be OK?
Hide
Tim Hunt added a comment -

Well, if you must. But what is the current error message? What problem does the require_once cause - surely it is the better solution if it works?

Show
Tim Hunt added a comment - Well, if you must. But what is the current error message? What problem does the require_once cause - surely it is the better solution if it works?
Hide
Gordon Bateson added a comment -

> What problem does the require_once cause -

A quiz with 6 questions is imported as having 9 questions, 3 of which are gobbledy-gook.

> surely it is the better solution if it works?

It doesn't work on Moodle 1.9, so it is surely not a better solution.

I would like to undo the fix on Moodle 1.9 and look at the problem carefully later. We can leave Moodle 2.0 as it is.

Show
Gordon Bateson added a comment - > What problem does the require_once cause - A quiz with 6 questions is imported as having 9 questions, 3 of which are gobbledy-gook. > surely it is the better solution if it works? It doesn't work on Moodle 1.9, so it is surely not a better solution. I would like to undo the fix on Moodle 1.9 and look at the problem carefully later. We can leave Moodle 2.0 as it is.
Hide
Tim Hunt added a comment -

If you attach the file you are using for testing here now, I will fix it today.

These changes went in after the weekly build. We can afford to take a few hours to get this right.

Show
Tim Hunt added a comment - If you attach the file you are using for testing here now, I will fix it today. These changes went in after the weekly build. We can afford to take a few hours to get this right.
Hide
Gordon Bateson added a comment -

Here is a file to test with.

It is a JQuiz file containing 4 questions:

  • multiple choice
  • short-answer
  • hybrid (starts as SA and changes to MC)
  • multi-select

JQuiz and the other 5 programs in the Hot Potatoes authoring suite from here:

FYI, Hot Potatoes is free to download and use.

Show
Gordon Bateson added a comment - Here is a file to test with. It is a JQuiz file containing 4 questions:
  • multiple choice
  • short-answer
  • hybrid (starts as SA and changes to MC)
  • multi-select
JQuiz and the other 5 programs in the Hot Potatoes authoring suite from here: FYI, Hot Potatoes is free to download and use.
Hide
Gordon Bateson added a comment -

> I will fix it today

Great. Thanks very much for the help.

Show
Gordon Bateson added a comment - > I will fix it today Great. Thanks very much for the help.
Hide
Tim Hunt added a comment -

Right. hotpot_convert_relative_urls was not defined in lib, so that one funcition needs to be in format.php.

That affected both 2.0 and 1.9. I can now successfully import the attached test file in both my test sites.

Thanks for catching my regression Gordon.

Show
Tim Hunt added a comment - Right. hotpot_convert_relative_urls was not defined in lib, so that one funcition needs to be in format.php. That affected both 2.0 and 1.9. I can now successfully import the attached test file in both my test sites. Thanks for catching my regression Gordon.
Hide
Gordon Bateson added a comment -

That's great news!

I have confirmed that import of all other types of Hot Potatoes quiz are working as well, on both Moodle 1.9 and Moodle 2.0, so that's a great step forward.

And the code is a lot cleaner now too.

Well done Tim and thanks!
Gordon

Show
Gordon Bateson added a comment - That's great news! I have confirmed that import of all other types of Hot Potatoes quiz are working as well, on both Moodle 1.9 and Moodle 2.0, so that's a great step forward. And the code is a lot cleaner now too. Well done Tim and thanks! Gordon

People

Vote (0)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: