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

[BUGFIX] Fix array key access in ext_getSetup #3360

Merged
merged 1 commit into from
Oct 18, 2022
Merged

[BUGFIX] Fix array key access in ext_getSetup #3360

merged 1 commit into from
Oct 18, 2022

Conversation

saitho
Copy link
Contributor

@saitho saitho commented Oct 17, 2022

What this pr does

Reading nested TypoScript will no longer log a warning when the value can not be accessed. In this case, the second value in the array returned in TypoScript::ext_getSetup will be an empty string. However, the second value is not used by Ext:solr anymore.

This also fixes an issue with PHP 8 where such warning would cause the indexing to fail, when the method is used inside of an indexer.

How to test

Set in TypoScript setup:

plugin.tx_myextension {
  settings {
    foo = bar
  }
}

Place this snipped inside a Solr indexer or Solr indexer hook:

use ApacheSolrForTypo3\Solr\FrontendEnvironment;

// @var $indexItem \ApacheSolrForTypo3\Solr\IndexQueue\Item

$settings =  GeneralUtility::makeInstance(FrontendEnvironment::class)
  ->getConfigurationFromPageId($indexItem->getRootPageUid(), 'plugin.tx_myextension', 0);
$config = $settings->getObjectByPathOrDefault('settings', []);
// $config should return the array ['foo' => 'bar']

Indexing should no longer produce a PHP warning and it should succeed in PHP 8.

Fixes: #3359

Reading nested TypoScript will no longer log a warning when the
value can not be accessed. In this case, the second value in the
array returned in `TypoScript::ext_getSetup` will be an empty string.
However, the second value is not used by Ext:solr anymore.

This also fixes an issue with PHP 8 where such warning would cause the
indexing to fail, when the method is used inside of an indexer.

Fixes: #3359
@dkd-kaehm dkd-kaehm added the BACKPORTABLE The changes SHOULD be backported label Oct 17, 2022
Copy link
Collaborator

@dkd-kaehm dkd-kaehm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@saitho
Thanks for that fix.
It will be merged after 11.5 port is created.

@dkd-kaehm dkd-kaehm merged commit 427279a into TYPO3-Solr:main Oct 18, 2022
dkd-kaehm pushed a commit that referenced this pull request Oct 18, 2022
Reading nested TypoScript will no longer log a warning when the
value can not be accessed. In this case, the second value in the
array returned in `TypoScript::ext_getSetup` will be an empty string.
However, the second value is not used by Ext:solr anymore.

This also fixes an issue with PHP 8 where such warning would cause the
indexing to fail, when the method is used inside of an indexer.

Fixes: #3359
Ports: #3360
@dkd-kaehm dkd-kaehm mentioned this pull request Oct 13, 2023
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BACKPORTABLE The changes SHOULD be backported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] PHP 8: Warning in ext_getSetup aborts indexing
2 participants