Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-13553

Controller helper needs a message handler to replace error handler

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Fixed
    • Icon: Major Major
    • 3.1.3-RC2
    • 3.1.3-RC1, 3.2.0-dev
    • Other
    • None

      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

            nickvergessen Joas Schilling
            VSE Matt Friedman [X] (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: