Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-28025

Improve error message when $PAGE->context is not set

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.4
    • Fix Version/s: 2.1
    • Component/s: Libraries
    • Labels:
      None
    • Testing Instructions:
      Hide

      Create a page that includes config.php, then calls $OUTPUT->header() without calling $PAGE->set_context() or require_login() first. The page will display a warning then display the content.

      Show
      Create a page that includes config.php, then calls $OUTPUT->header() without calling $PAGE->set_context() or require_login() first. The page will display a warning then display the content.
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE
    • Pull Master Branch:
      pagelib_single

      Description

      The error message displayed when $OUTPUT->header() is called before $PAGE->set_context() currently doesn't explain what the problem is or how to fix it.

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            timhunt Tim Hunt added a comment -

            Review comments:

            1. I would have 1 space after a full stop.

            2. Also, for the first sentence, I think "$PAGE->context was not set" is clearer.

            3. Finally, Moodle code is meant to wrap at 100chars (and certainly no more than 140) so the line is too long.

            Show
            timhunt Tim Hunt added a comment - Review comments: 1. I would have 1 space after a full stop. 2. Also, for the first sentence, I think "$PAGE->context was not set" is clearer. 3. Finally, Moodle code is meant to wrap at 100chars (and certainly no more than 140) so the line is too long.
            Hide
            marxjohnson Mark Johnson added a comment -
            Show
            marxjohnson Mark Johnson added a comment - I've made those changes: https://github.com/marxjohnson/moodle/compare/master...pagelib
            Hide
            timhunt Tim Hunt added a comment -

            The code is now great. Can you just squash the changes down to be a single commit (e.g. git rebase -i).

            Finally, you need to get your commit comment right. See http://docs.moodle.org/dev/Commit_cheat_sheet

            I would suggest

            MDL-28025 pagelib improve error message when $PAGE->context isn't set

            Show
            timhunt Tim Hunt added a comment - The code is now great. Can you just squash the changes down to be a single commit (e.g. git rebase -i). Finally, you need to get your commit comment right. See http://docs.moodle.org/dev/Commit_cheat_sheet I would suggest MDL-28025 pagelib improve error message when $PAGE->context isn't set
            Hide
            marxjohnson Mark Johnson added a comment -

            I've made those changes and updated the Git links to point to the new single commit.

            Show
            marxjohnson Mark Johnson added a comment - I've made those changes and updated the Git links to point to the new single commit.
            Hide
            timhunt Tim Hunt added a comment -

            +1 from me. Submitting for integration.

            Show
            timhunt Tim Hunt added a comment - +1 from me. Submitting for integration.
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            nice little msg. Integrated, thanks!

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - nice little msg. Integrated, thanks!
            Hide
            blepoxp Glenn Ansley added a comment -

            Works properly. Missing an ending period but it works as described.

            Show
            blepoxp Glenn Ansley added a comment - Works properly. Missing an ending period but it works as described.
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Special thanks Glenn! Closing!

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Special thanks Glenn! Closing!

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  1/Jul/11