Moodle
  1. Moodle
  2. MDL-26968

Fatal error when adding new quiz or accessing existing quiz

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Not a bug
    • Affects Version/s: 2.0.2
    • Fix Version/s: None
    • Component/s: Quiz
    • Labels:
      None
    • Environment:
      Ubuntu 10.04.2 LTS, Apache/2.2.14, PHP 5.3.2-1ubuntu4.7 with Suhosin-Patch (cli), mysql Ver 14.14 Distrib 5.1.41,
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_20_STABLE
    • Rank:
      16594

      Description

      When trying to access an existing quiz, or when adding a new quiz to a course, the following error is received:

      Fatal error: Can't use function return value in write context in /srv/moodle2/mod/quiz/locallib.php on line 1157

      Steps to reproduce:

      1. Either create a new course or access an existing course
      2. Click Add an Activity / Quiz

      ...or:

      1. Go to an existing course with a quiz already in place
      2. Click on quiz

      Any quizzes which were already in place were there prior to the upgrade to this week's weekly build (2.0.2+ (Build: 20110323)). The last build was 2 weeks' prior (2.0.2+, 20110309).

        Activity

        Hide
        Tim Hunt added a comment -

        The last change in mod/quiz/locallib.php was on 23rd Feb in a completely unrelated bit of code.

        The last change that might possibly have affected this was on 15th February, and I am sure that lots of people have successfully edited quizzes since then.

        What does line 1157 of mod/quiz/locallib.php look like in your version, and how does that compare to https://github.com/moodle/moodle/blob/master/mod/quiz/locallib.php#L1157 ?

        Show
        Tim Hunt added a comment - The last change in mod/quiz/locallib.php was on 23rd Feb in a completely unrelated bit of code. The last change that might possibly have affected this was on 15th February, and I am sure that lots of people have successfully edited quizzes since then. What does line 1157 of mod/quiz/locallib.php look like in your version, and how does that compare to https://github.com/moodle/moodle/blob/master/mod/quiz/locallib.php#L1157 ?
        Hide
        Paul Vaughan added a comment -

        As I couldn't find any evidence of this error elsewhere, I was worried that it seemed a bit specific to me.

        I appeared to have gained (or not lost) a !empty compared to the master branch as my line 1157 reads:

        switch (!empty(quiz_send_confirmation($a))) {

        Less of a Moodle bug, more of a git training issue :/ although I don't know how my branch has diverged from the master branch. Master:

        d83bad41 (Petr Skoda 2011-02-15 15:06:24 +0100 1157) switch (quiz_send_confirmation($a)) {

        My clone of it:

        8bf6f4dc (andyjdavis 2011-02-10 13:25:38 +0800 1157) switch (!empty(quiz_send_confirmation($a))) {

        ...but doing a merge says 'everything up to date'. Odd.

        Sorry for the noise. I'll go stare at my git repos and try to work out what I've done.

        Show
        Paul Vaughan added a comment - As I couldn't find any evidence of this error elsewhere, I was worried that it seemed a bit specific to me. I appeared to have gained (or not lost) a !empty compared to the master branch as my line 1157 reads: switch (!empty(quiz_send_confirmation($a))) { Less of a Moodle bug, more of a git training issue :/ although I don't know how my branch has diverged from the master branch. Master: d83bad41 (Petr Skoda 2011-02-15 15:06:24 +0100 1157) switch (quiz_send_confirmation($a)) { My clone of it: 8bf6f4dc (andyjdavis 2011-02-10 13:25:38 +0800 1157) switch (!empty(quiz_send_confirmation($a))) { ...but doing a merge says 'everything up to date'. Odd. Sorry for the noise. I'll go stare at my git repos and try to work out what I've done.
        Hide
        Tim Hunt added a comment -

        Will gitk, git log and git blame are the commands to try to work out what is happening.

        And, if you are sure you have no local customisations, then git reset --hard origin/MOODLE_20_STABLE will get your branch to exactly the same state as the official one. (Be careful, that command is distructive!)

        Show
        Tim Hunt added a comment - Will gitk, git log and git blame are the commands to try to work out what is happening. And, if you are sure you have no local customisations, then git reset --hard origin/MOODLE_20_STABLE will get your branch to exactly the same state as the official one. (Be careful, that command is distructive!)

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: