Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant