Skip to content
This repository has been archived by the owner on Feb 3, 2025. It is now read-only.

InvalidTemplateResourceException for hidden pages #405

Closed
wazum opened this issue Jan 11, 2019 · 2 comments
Closed

InvalidTemplateResourceException for hidden pages #405

wazum opened this issue Jan 11, 2019 · 2 comments

Comments

@wazum
Copy link

wazum commented Jan 11, 2019

TYPO3 CMS: 9.5.3
flux: 9.1.0
fluidpages: 4.3.0

InvalidTemplateResourceException for preview of hidden pages.

Problem is that \FluidTYPO3\Flux\Service\RecordService::getSingle returns false in this case (and not a record, even if 'Show hidden pages' is checked in the admin panel) and therefor the page configuration (up the root line) cannot be loaded.

@wazum
Copy link
Author

wazum commented Jan 11, 2019

The method is completely wrong

     * @param string $table
     * @param string $fields
     * @param string $uid
     * @return array|NULL
     */
    public function getSingle($table, $fields, $uid)
    {
        return BackendUtility::getRecord($table, $uid, $fields);
        if (TYPO3_MODE === 'BE') {
            return BackendUtility::getRecord($table, $uid, $fields);
        }
        $results = $this->getQueryBuilder($table)
            ->from($table)
            ->select(...explode(',', $fields))
            ->where(sprintf('uid = %d', $uid))
            ->execute()
            ->fetchAll() ?: [];
        return reset($results);
    }

(it even may return false)
the old version looked like this:

     * @param string $table
     * @param string $fields
     * @param string $uid
     * @return array|NULL
     */
    public function getSingle($table, $fields, $uid)
    {
        $connection = $this->getDatabaseConnection();
        $record = $connection->exec_SELECTgetSingleRow($fields, $table, "uid = '" . intval($uid) . "'");
        return false !== $record ? $record : null;
    }

and does not take any restrictions into account.

@wazum
Copy link
Author

wazum commented Jan 11, 2019

Moved issue to flux

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant