Fixed Incomplete return type hint for \XF\Http\Request::getFile

Kirby

Well-known member
Licensed customer
Affected version
2.3.13
PHP:
/**
 * @param string $key
 * @param bool $multiple If true, returns an array of uploads for this key
 * @param bool $skipErrors If true, uploads with errors will not be returned
 *
 * @return Upload|Upload[]
 */
public function getFile($key, $multiple = false, $skipErrors = true)
{
    if (!$this->fileExists($key))
    {
        return ($multiple ? [] : null);
    }

    [...]
   
    $output = [];

    [...]

    if ($multiple)
    {
        return $output;
    }
    else
    {
        return reset($output);
    }
}

Given this code the method may also return null or false
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.3.14).

Change log:
Document that fetching a single uploaded file can return nothing
There may be a delay before changes are rolled out to the XenForo Community.
 
Back
Top Bottom