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] Error PageInformation::$localRootLine must not be accessed before initialization #4287

Open
Nimmermaer opened this issue Jan 17, 2025 · 2 comments

Comments

@Nimmermaer
Copy link

Nimmermaer commented Jan 17, 2025

Describe the bug

A fatal error occurs in the backend module while indexing an Index Queue item. The error message indicates that the localRootLine property of TYPO3\CMS\Frontend\Page\PageInformation is accessed before it has been initialized.

component="ApacheSolrForTypo3.Solr.Domain.Index.IndexService": Failed indexing Index Queue item 457757 - {"code":0,"message":"Typed property TYPO3\\CMS\\Frontend\\Page\\PageInformation::$localRootLine must not be accessed before initialization","trace":"
#0 /var/www/html/vendor/typo3/cms-frontend/Classes/ContentObject/ContentObjectRenderer.php(3921): TYPO3\\CMS\\Frontend\\Page\\PageInformation->getLocalRootLine()
#1 /var/www/html/vendor/typo3/cms-frontend/Classes/ContentObject/ContentObjectRenderer.php(1301): TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer->getData('levelfield : -1...', Array)
#2 /var/www/html/vendor/typo3/cms-frontend/Classes/ContentObject/ContentObjectRenderer.php(1160): 

To Reproduce

  1. Use the following TypoScript configuration for indexing records:
plugin {
    tx_solr {
        index {
            queue {
                events = 1
                events < plugin.tx_solr.index.queue.news
                events {
                    additionalWhereClause = type = 3
                    fields {
                        type_stringS = TEXT
                        type_stringS.value = event
                    }
                    url {
                        default {
                            typolink.parameter.data = levelfield : -1 , tx_sitepackage_event_detail_page, slide
                        }
                    }
                }
            }
        }
    }
}
  1. Ensure that editors can manage page settings dynamically without hardcoded values.
  2. Trigger indexing for the events queue.
  3. The error occurs, preventing proper indexing.

Expected behavior
Indexing should work correctly without accessing uninitialized properties. The localRootLine property should be set before calling getLocalRootLine().

Used versions

  • TYPO3 Version: 13.4.2
  • EXT:solr Version: 13.0.0
  • PHP Version: 8.3

Fix

To fix the issue, we modified \ApacheSolrForTypo3\Solr\FrontendEnvironment\Tsfe.php after this position Tsfe.php to ensure the localRootLine is set before usage:

$pageInformation->setContentFromPid($pageId);
$rootLine = GeneralUtility::makeInstance(RootlineUtility::class, $pageId)->get();
$pageInformation->setLocalRootLine($rootLine);

This change ensures that the root line is initialized before being accessed.

Is this helpful, or did I miss any important points?
If not, I’d be happy to contribute.

@dkd-kaehm
Copy link
Collaborator

dkd-kaehm commented Jan 17, 2025

Does it happen on stable 13.0.0 release?

@Nimmermaer
Copy link
Author

Sorry, I accidentally included my version of solrfal.
Yes, I have Solr 13.0.0 and have changed that in the report.

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

2 participants