Project

General

Profile

Actions

Bug #87125

closed

FrontendGroupRestriction class explode-Error in constructor

Added by cosmoblonde GmbH over 5 years ago. Updated over 5 years ago.

Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2018-12-11
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

In several of my typo3 websites I have now experienced the same error while upgrading from v7.6 to v8.6.
In the Class /typo3/sysext/core/Classes/Database/Query/Restriction/FrontendGroupRestriction in the constructor the line:

$this->frontendGroupIds = $frontendGroupIds === null ? explode(',', $GLOBALS['TSFE']->gr_list) : $frontendGroupIds;

throws an error on the explode command when executed from the TYPO3 BE.

This Bug has been reported before (https://forge.typo3.org/issues/79354, https://forge.typo3.org/issues/80917), but has not been resolved.
The error only happens in the TYPO3 BE, caused by different tasks (e.g. by the solr extension creating the queue or by other 3rd party extensions)

Would it be possible to add a $GLOBALS['TSFE'] check or a "if (TYPO3_MODE == 'FE')" check (as suggested in the related issues), before executing the explode command?


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #79354: PageRepository::getPage fails in Backend contextRejected2017-01-17

Actions
Related to TYPO3 Core - Bug #80917: Backend: Uncaught TYPO3 Exception in FrontendGroupRestriction constructor if $GLOBALS['TSFE']->gr_list is nullClosed2017-04-20

Actions
Actions #1

Updated by cosmoblonde GmbH over 5 years ago

  • Related to Bug #79354: PageRepository::getPage fails in Backend context added
Actions #2

Updated by Georg Ringer over 5 years ago

  • Related to Bug #80917: Backend: Uncaught TYPO3 Exception in FrontendGroupRestriction constructor if $GLOBALS['TSFE']->gr_list is null added
Actions #3

Updated by Georg Ringer over 5 years ago

  • Status changed from New to Needs Feedback

can you link the code where this is used in solr? why is the TSFE not fully initialized?

Actions #4

Updated by cosmoblonde GmbH over 5 years ago

To be more precise, the problem appears when using solrfal. When a file is added to the index queue either by the planner task or when editing a record (e.g. news) that has files attached.
This is the error message:

Uncaught TYPO3 Exception
explode() expects parameter 2 to be string, null given

TypeError thrown in file
/html/typo3/site_v8/shared/vendor/typo3_src-8.7.21/typo3/sysext/core/Classes/Database/Query/Restriction/FrontendGroupRestriction.php in line 37.

24 explode(",", NULL)

/html/typo3/site_v8/shared/vendor/typo3_src-8.7.21/typo3/sysext/core/Classes/Database/Query/Restriction/FrontendGroupRestriction.php:

00035: {
00036: // if (TYPO3_MODE 'FE'){

00037: $this->frontendGroupIds = $frontendGroupIds = null ? explode(',', $GLOBALS['TSFE']->gr_list) : $frontendGroupIds;

00038: // }else{
00039: // $this->frontendGroupIds = array();

23 TYPO3\CMS\Core\Database\Query\Restriction\FrontendGroupRestriction::__construct()

/html/typo3/site_v8/shared/vendor/typo3_src-8.7.21/typo3/sysext/core/Classes/Utility/GeneralUtility.php:

03961: }
03962: // Create new instance and call constructor with parameters

03963: $instance = new $finalClassName(...$constructorArguments);

03964: // Register new singleton instance
03965: if ($instance instanceof SingletonInterface) {

22 TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance("TYPO3\CMS\Core\Database\Query\Restriction\FrontendGroupRestriction")

/html/typo3/site_v8/shared/vendor/typo3_src-8.7.21/typo3/sysext/core/Classes/Database/Query/Restriction/AbstractRestrictionContainer.php:

00099: protected function createRestriction($restrictionClass)
00100: {

00101: return GeneralUtility::makeInstance($restrictionClass);

00102: }
00103: }

21 TYPO3\CMS\Core\Database\Query\Restriction\AbstractRestrictionContainer::createRestriction("TYPO3\CMS\Core\Database\Query\Restriction\FrontendGroupRestriction")

/html/typo3/site_v8/shared/vendor/typo3_src-8.7.21/typo3/sysext/core/Classes/Database/Query/Restriction/FrontendRestrictionContainer.php:

00045: {
00046: foreach ($this->defaultRestrictionTypes as $restrictionType) {

00047: $this->add($this->createRestriction($restrictionType));

00048: }
00049: }

20 TYPO3\CMS\Core\Database\Query\Restriction\FrontendRestrictionContainer::__construct()

/html/typo3/site_v8/shared/vendor/typo3_src-8.7.21/typo3/sysext/core/Classes/Utility/GeneralUtility.php:

03961: }
03962: // Create new instance and call constructor with parameters

03963: $instance = new $finalClassName(...$constructorArguments);

03964: // Register new singleton instance
03965: if ($instance instanceof SingletonInterface) {

19 TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance("TYPO3\CMS\Core\Database\Query\Restriction\FrontendRestrictionContainer")

/html/typo3/site_v8/shared/vendor/typo3_src-8.7.21/typo3/sysext/frontend/Classes/Page/PageRepository.php:

00562: >getQueryBuilderForTable($table);
00563: $queryBuilder
>setRestrictions(

00564: GeneralUtility::makeInstance(FrontendRestrictionContainer::class)

00565: );
00566: $olrow = $queryBuilder->select('*')

18 TYPO3\CMS\Frontend\Page\PageRepository::getRecordOverlay("tx_news_domain_model_news", array, 1, "hideNonTranslated")

/html/typo3/site_v8/releases/initial/typo3conf/ext/solrfal/Classes/Detection/RecordContextDetector.php:

00154: $record,
00155: (int)$language,

00156: 'hideNonTranslated'

00157: );
00158: if ($translation) {

17 ApacheSolrForTypo3\Solrfal\Detection\RecordContextDetector::extractQueueItemsFromRecord("news", "tx_news_domain_model_news", array, array)

/html/typo3/site_v8/releases/initial/typo3conf/ext/solrfal/Classes/Detection/RecordContextDetector.php:

00298: $table,
00299: $record,

00300: $this->getFieldsToIndex($indexingConfiguration, $table)

00301: );
00302: } else {

16 ApacheSolrForTypo3\Solrfal\Detection\RecordContextDetector::recordCreated("tx_news_domain_model_news", 1493)

/html/typo3/site_v8/releases/initial/typo3conf/ext/solrfal/Classes/Detection/RecordContextDetector.php:

00321: }
00322:

00323: $this->recordCreated($table, $uid);

00324: }
00325:

15 ApacheSolrForTypo3\Solrfal\Detection\RecordContextDetector::recordUpdated("tx_news_domain_model_news", 1493)

/html/typo3/site_v8/releases/initial/typo3conf/ext/solrfal/Classes/Queue/ConsistencyAspect.php:

00182: $detectors = $this->getDetectorsForRecord($table, $uid);
00183: foreach ($detectors as $detector) {

00184: $detector->$function($table, $uid);

00185: }
00186: }

14 ApacheSolrForTypo3\Solrfal\Queue\ConsistencyAspect::issueCommandOnDetectors("recordUpdated", "sys_file_reference", 2644)

/html/typo3/site_v8/releases/initial/typo3conf/ext/solrfal/Classes/Queue/ConsistencyAspect.php:

00168: }
00169: if ($method !== '') {

00170: $this->issueCommandOnDetectors($method, $table, $id);

00171: }
00172: }

--------------------cut-------------------------------

But as mentioned before, I had the same error in a custom extension (indexing to ElasticSearch).

Actions #5

Updated by Georg Ringer over 5 years ago

but how does the code look like to buil the tsfe? why it is not set there?

Actions #6

Updated by cosmoblonde GmbH over 5 years ago

There is no code that builds/initializes the TSFE (possibly because it is called form the backend) and as it is a 3rd party extension, I would like to not make any changes here.
Is it not possible to just add a null check in the FrontendGroupRestriction class?

Actions #7

Updated by Georg Ringer over 5 years ago

  • Status changed from Needs Feedback to Rejected

in the FE TSFE is full initialized. The check won't be added as this would be just wrong. it TSFE is built incomplete by a 3rd party extension, it must be fixed there instead of in the core.

Timo Hund said it is no problem in EXT:solr as he remembers that EXT:solr has been changed in that regard.

Actions

Also available in: Atom PDF