Moodle
  1. Moodle
  2. MDL-28025

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

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor 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
    • Rank:
      17994

      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.

        Activity

        Hide
        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
        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
        Mark Johnson added a comment -
        Show
        Mark Johnson added a comment - I've made those changes: https://github.com/marxjohnson/moodle/compare/master...pagelib
        Hide
        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
        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
        Mark Johnson added a comment -

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

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

        +1 from me. Submitting for integration.

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

        nice little msg. Integrated, thanks!

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

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

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

        Special thanks Glenn! Closing!

        Show
        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: