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

Inconsistent behavior in request_var

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Invalid
    • 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6, 3.0.7, 3.0.7-PL1, 3.0.8-RC1, 3.0.8
    • None
    • Other
    • None

    Description

      As we all know, request_var takes in two parameters. The first is the variable to request while the second is the default to return if the requested variable is not found in the various superglobals. It is also used to define the type to be returned. While request_var returns the default value specified for any type, it does not return the default value when that default is of type array. Upon closer inspection of request_var I found this in the first few lines:

      if (!isset($_GET[$var_name]) && !isset($_POST[$var_name]))
      {
      	return (is_array($default)) ? array() : $default;
      }

      I'm not sure what the reasoning is behind returning the default value for all types except for arrays but it seems inconsistent. The is_array check should probably be removed unless there is a very good reason for it, which I'm not really seeing.

      Attachments

        Activity

          People

            Unassigned Unassigned
            DavidIQ David Colón
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: