Not a bug getInput() in Approval Queue Handler expects the default value to be empty string

Affected version
XF 2.2

TickTackk

Well-known member
PHP:
    protected function getInput($key, $id)
    {
        if (!isset($this->filterCache[$key]))
        {
            $this->filterCache[$key] = $this->inputFilterer->filter($key, 'array');
        }

        return !empty($this->filterCache[$key][$this->contentType][$id]) ? $this->filterCache[$key][$this->contentType][$id] : '';
    }
if the key + content type + content id combo does not exist, it just assumes the default value would be empty string. It would be nice to pass a third argument which can act as a default.
 

Mike

XenForo developer
Staff member
This function is actually more opinionated than you're suggesting as it also rejects empty values.

At this point, if you need a different behavior, you'll need to implement something specific for your needs. (This isn't something that could be changed within the 2.2 series as it requires a method signature change.)
 
Top