Moodle
  1. Moodle
  2. MDL-30391

Exceptions thrown during a restore and being mangled and unreadable.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2
    • Fix Version/s: 2.1.3
    • Component/s: Backup
    • Labels:
    • Testing Instructions:
      Hide

      Note: Testing needs developer to modify code

      1. Open backup/restore.php for editing
      2. Add exception just before restore->execute() on line 46

        throw new moodle_exception("Testing");

      3. Log in as admin
      4. Select an existing course or create new course.
      5. Backup an existing/new course (settings -> backup)
      6. Restore this course as new course
        • Start restore process (settings -> restore -> click on restore link)
        • Confirm details (Press continue)
        • Restore as a new course (In top section "Restore as a new course" select a category and click continue)
        • Press next on settings and Schema page
        • On review page click perform restore
      7. you should not see error message like :

        error/exception 'moodle_exception' with message 'error/Testing' in /usr/local/www/moodle/backup/restore.php:46 Stack trace: #0 {main}

      8. Message should be proper message, with proper Debug information (If debugging is set to developer)

        Coding error detected, it must be fixed by a programmer: PHP catchable fatal error

      Show
      Note: Testing needs developer to modify code Open backup/restore.php for editing Add exception just before restore->execute() on line 46 throw new moodle_exception("Testing"); Log in as admin Select an existing course or create new course. Backup an existing/new course (settings -> backup) Restore this course as new course Start restore process (settings -> restore -> click on restore link) Confirm details (Press continue) Restore as a new course (In top section "Restore as a new course" select a category and click continue) Press next on settings and Schema page On review page click perform restore you should not see error message like : error/exception 'moodle_exception' with message 'error/Testing' in /usr/local/www/moodle/backup/restore.php:46 Stack trace: #0 {main} Message should be proper message, with proper Debug information (If debugging is set to developer) Coding error detected, it must be fixed by a programmer: PHP catchable fatal error
    • Affected Branches:
      MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE
    • Pull Master Branch:
      wip-mdl-30391

      Description

      There is a regression from MDL-27790 whereby exceptions occurring during a restore are being output into a new exception and thrown again.
      This leads to those exceptions being output looking like garbage and making them very hard to read.
      Surely the code should just be throwing the existing exception when it has done what it needs to?

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            Sam Hemelryk added a comment -

            Offending code:

            throw new moodle_exception((string)$e);
            

            Show
            Sam Hemelryk added a comment - Offending code: throw new moodle_exception((string)$e);
            Hide
            Aparup Banerjee added a comment -

            agreed. i wonder how i missed that.

            Show
            Aparup Banerjee added a comment - agreed. i wonder how i missed that.
            Hide
            Rajesh Taneja added a comment -

            grrr... Silly me..
            Thanks Sam for pointing this out

            Show
            Rajesh Taneja added a comment - grrr... Silly me.. Thanks Sam for pointing this out
            Hide
            Jason Fowler added a comment -

            looks sane and clean

            Show
            Jason Fowler added a comment - looks sane and clean
            Hide
            Sam Hemelryk added a comment -

            Thanks guys - this has been integrated now

            Show
            Sam Hemelryk added a comment - Thanks guys - this has been integrated now
            Hide
            Sam Hemelryk added a comment -

            Tested during integration.

            During testing I found another issue - this time not related. MDL-30454

            Show
            Sam Hemelryk added a comment - Tested during integration. During testing I found another issue - this time not related. MDL-30454
            Hide
            Eloy Lafuente (stronk7) added a comment -

            And this has landed upstream, just on time for the upcoming new releases week. Thanks for it!

            Ciao

            Show
            Eloy Lafuente (stronk7) added a comment - And this has landed upstream, just on time for the upcoming new releases week. Thanks for it! Ciao

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: