@sgiehl opened this Issue on November 30th 2017 Member

While trying to resolve another issue, I spotted this piece of code.
Not sure if it is a bug or if it just can be removed, as the code can't be working since 2014:

    /**
     * <a class='mention' href='https://github.com/param'>@param</a> $actionType
     * <a class='mention' href='https://github.com/return'>@return</a> bool
     */
    private static function isActionTypeStoredUnsanitized($actionType)
    {
        $actionsTypesStoredUnsanitized = array(
            $actionType == Action::TYPE_DOWNLOAD,
            $actionType == Action::TYPE_OUTLINK,
            $actionType == Action::TYPE_PAGE_URL,
            $actionType == Action::TYPE_CONTENT,
        );

        return in_array($actionType, $actionsTypesStoredUnsanitized);
    }

I don't think this method can return anything else than false. It's only used once, so maybe we can simply remove it.

@mattab commented on December 14th 2017 Owner

@sgiehl It looks like this method is very buggy indeed.
However if I read this correctly, it would still return true if and only $actionType is Action::TYPE_PAGE_URL ? ($actionType == Action::TYPE_PAGE_URL would be true, and in_array(1, array(true)) would return true.

@sgiehl commented on December 14th 2017 Member

seems we are both wrong. just tested that on command line. The method will always return true unless the value of $actionType is false (casted to boolean)

Powered by GitHub Issue Mirror