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

TickTackk

Well-known member
Affected version
XF 2.2
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.
 
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 Bottom