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

[BUG] Return value getPageItemChangedTime() must be of the type int, null returned #3806

Closed
2 tasks
Tracked by #3376
hdietrich-timespin opened this issue Sep 27, 2023 · 2 comments · Fixed by #3812
Closed
2 tasks
Tracked by #3376
Assignees

Comments

@hdietrich-timespin
Copy link

hdietrich-timespin commented Sep 27, 2023

Core: Exception handler (WEB): Uncaught TYPO3 Exception: Return value of ApacheSolrForTypo3\Solr\IndexQueue\Queue::getPageItemChangedTime() must be of the type int, null returned

here is the function:

    protected function getPageItemChangedTime(array $page): int
    {
        if (!empty($page['content_from_pid'])) {
            // canonical page, get the original page's last changed time
            return $this->queueItemRepository->getPageItemChangedTimeByPageUid((int)$page['content_from_pid']);
        }
        return $this->queueItemRepository->getPageItemChangedTimeByPageUid((int)$page['uid']) ?? 0;
    }

Problem
The used function getPageItemChangedTimeByPageUid returns ?int => int|null, so you must cast return to "int"

 return (int) $this->queueItemRepository->getPageItemChangedTimeByPageUid((int)$page['content_from_pid']) ;

or add ?? 0

return $this->queueItemRepository->getPageItemChangedTimeByPageUid((int)$page['content_from_pid']) ?? 0;

or change return from function to:

    protected function getPageItemChangedTime(array $page): ?int
{ ....}

Used versions

  • EXT:solr Version: 11.5.1

Maintainers comments:

Target branches:

  • release-11.5.x
  • main
@dkd-kaehm
Copy link
Collaborator

@hdietrich-timespin thanks for reporting that issue.
Could you please provide a PR with ..((int)$page['content_from_pid']) ?? 0 variant?

@hdietrich-timespin
Copy link
Author

I can not provide a PR!

dkd-kaehm added a commit to dkd-kaehm/ext-solr that referenced this issue Oct 6, 2023
Fixes the error:
Uncaught TYPO3 Exception: Return value of ApacheSolrForTypo3\Solr\IndexQueue\Queue::getPageItemChangedTime() must be of the type int, null returned

Fixes: TYPO3-Solr#3806
dkd-kaehm added a commit to dkd-kaehm/ext-solr that referenced this issue Oct 6, 2023
Fixes the error:
Uncaught TYPO3 Exception: Return value of ApacheSolrForTypo3\Solr\IndexQueue\Queue::getPageItemChangedTime() must be of the type int, null returned

Fixes: TYPO3-Solr#3806
Ports: TYPO3-Solr#3812
dkd-kaehm added a commit that referenced this issue Oct 6, 2023
Fixes the error:
Uncaught TYPO3 Exception: Return value of ApacheSolrForTypo3\Solr\IndexQueue\Queue::getPageItemChangedTime() must be of the type int, null returned

Fixes: #3806
Ports: #3812
dkd-kaehm added a commit that referenced this issue Oct 6, 2023
Fixes the error:
Uncaught TYPO3 Exception: Return value of ApacheSolrForTypo3\Solr\IndexQueue\Queue::getPageItemChangedTime() must be of the type int, null returned

Fixes: #3806
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

Successfully merging a pull request may close this issue.

3 participants