Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-13553

Controller helper needs a message handler to replace error handler

    Details

    • Type: Task
    • Status: Unverified Fix
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.1.3-RC1, 3.2.0-dev
    • Fix Version/s: 3.1.3-RC2
    • Component/s: Other
    • Labels:
      None

      Description

      Now that the controller helper's error() method has been deprecated in favor of using exceptions, the helper class needs a message() method that can be used to accomplish the same task that error() did, but always with a status 200.

      The error method (and trigger_error in the ACP) has become the routine method up till now for displaying a message back to the user, including simple tasks like confirmation of an post action, or for simple messages like for example if a controller page is not intended for the user to visit. Stuff like:

      return $helper->error($user->lang('SOME_MESSAGE'), 200)

      Throwing an exception is not appropriate when it's not really an exception or error, and the status code would be 200. We should have another method similar to the error method but with a hard-coded 200 status code, so we can easily render out to the message_body.html template once again:

      return $helper->message($user->lang('SOME_MESSAGE'));

      Discussion of this falling out from deprecating the error method here: https://www.phpbb.com/community/viewtopic.php?f=461&t=2291536

        Activity

        Hide
        nickvergessen Joas Schilling added a comment -

        use render('message_body') ?
        But I guess we can add that short cut

        Show
        nickvergessen Joas Schilling added a comment - use render('message_body') ? But I guess we can add that short cut
        Hide
        VSE Matt Friedman added a comment -

        We'd always have to manually set the template vars MESSAGE_TEXT and MESSAGE_TITLE, which it's nice that helper->error already does this

        Show
        VSE Matt Friedman added a comment - We'd always have to manually set the template vars MESSAGE_TEXT and MESSAGE_TITLE, which it's nice that helper->error already does this
        Hide
        nickvergessen Joas Schilling added a comment -

        which is what I just said

        Show
        nickvergessen Joas Schilling added a comment - which is what I just said
        Hide
        VSE Matt Friedman added a comment -

        Oo

        Show
        VSE Matt Friedman added a comment - Oo

          People

          • Assignee:
            nickvergessen Joas Schilling
            Reporter:
            VSE Matt Friedman
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development