Issue Details (XML | Word | Printable)

Key: MDL-20299
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Tim Hunt
Reporter: Sam Hemelryk
Votes: 0
Watchers: 3
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

Fatal error when attempting to import questions

Created: 16/Sep/09 03:00 PM   Updated: 12/Nov/09 04:17 PM
Return to search
Issue 593 of 20195 issue(s)
<< Previous | MDL-20299 | Next >>
Component/s: Questions
Affects Version/s: 2.0
Fix Version/s: 1.9.6, 2.0

File Attachments: 1. File jquiz.jqz (8 kB)

Issue Links:
Blockers
 

Participants: Gordon Bateson, Sam Hemelryk and Tim Hunt
Security Level: None
Resolved date: 01/Oct/09
Affected Branches: MOODLE_20_STABLE
Fixed Branches: MOODLE_19_STABLE, MOODLE_20_STABLE


 Description  « Hide
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

# 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

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Sam Hemelryk added a comment - 16/Sep/09 03:14 PM
Just noticed that it also does it on export.php but not quite so spectacular

Tim Hunt added a comment - 16/Sep/09 03:39 PM
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.

Tim Hunt added a comment - 01/Oct/09 01:20 AM
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.


Tim Hunt added a comment - 01/Oct/09 01:21 AM
By the way, I don't have any hotpot files to use to test this. Please can someone else do it.

Gordon Bateson added a comment - 01/Oct/09 08:01 AM
> 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


Tim Hunt added a comment - 01/Oct/09 02:44 PM
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.


Gordon Bateson added a comment - 01/Oct/09 03:13 PM
> 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?


Tim Hunt added a comment - 01/Oct/09 03:17 PM
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?

Gordon Bateson added a comment - 01/Oct/09 03:31 PM
> 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.


Tim Hunt added a comment - 01/Oct/09 03:33 PM
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.


Gordon Bateson added a comment - 01/Oct/09 03:45 PM
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.


Gordon Bateson added a comment - 01/Oct/09 03:47 PM
> I will fix it today

Great. Thanks very much for the help.


Tim Hunt added a comment - 01/Oct/09 06:13 PM
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.


Gordon Bateson added a comment - 01/Oct/09 07:01 PM
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