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

optionget/optionset functions in session.php and acp_users.php incorrectly check whether $data is at its default value

XMLWordPrintable

      Both functions (either as method of class user of or as method of class acp_users) in question are defined this way (simplified):

      function optionget( ... $data = false)
      {
      	...
      	$var = ($data) ? $data : $this->data['user_options'];
      	...
      }

      The problem in here is that $data will also evaluate to FALSE if it was handed over nonetheless. Consider a case where I use the $data parameter by giving the value 0 (ordinal zero) or '' (empty string) - this value wouldn't be used, instead

      $this->data['user_options']

      will be used. Which is fatal.

      A correct approach would be to test without invoking typecasts:

      function optionget( ... $data = false)
      {
      	...
      	$var = ($data !== false) ? $data : $this->data['user_options'];
      	...
      }

      I submitted this as minor bug because right now no code in phpBB uses the $data parameter, so nothing is affected. Only exception: the STK uses it in /tools/admin/reparse_bbcode.php, but obviously nobody ever had problems with it.

            Oleg Oleg [X] (Inactive)
            AmigoJack AmigoJack
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: