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] PHP Warning: Return value of SiteUtility::getConnectionProperty() must be of the type string #3394

Closed
SSFGizmo opened this issue Nov 7, 2022 · 1 comment · Fixed by #3397

Comments

@SSFGizmo
Copy link

SSFGizmo commented Nov 7, 2022

(1/1) TypeError

Return value of ApacheSolrForTypo3\Solr\System\Util\SiteUtility::getConnectionProperty() must be of the type string, null returned
in /solr/Classes/System/Util/SiteUtility.php line 81

I try to save one tt_content element on the page under "Page 2"

Root 1 (with site configuration 1)
 Page 1
 Root 2
   Page 2 (with site configuration 2)
  • TYPO3 Version: 11.5.17
  • EXT:solr Version: 99a5c11
  • PHP Version: 7.4.30
@dkd-kaehm
Copy link
Collaborator

@SSFGizmo
Thanks for reporting that issue.
There is a logic trouble in this method:

in release-11.5.x:

public static function getConnectionProperty(
Site $typo3Site,
string $property,
int $languageId,
string $scope,
$defaultValue = null
): string {
$value = self::getConnectionPropertyOrFallback($typo3Site, $property, $languageId, $scope);
if ($value === null) {
return $defaultValue;
}
return $value;
}

in release-11.2.x: as well:

public static function getConnectionProperty(Site $typo3Site, string $property, int $languageId, string $scope, string $defaultValue = null): string
{
$value = self::getConnectionPropertyOrFallback($typo3Site, $property, $languageId, $scope);
if ($value === null) {
return $defaultValue;
}
return $value;
}

Solution

Return type must be "mixed", because multiple calls set the mixed $defaultValue.

Target versions:

  • release-11.2.x
  • release-11.5.x
  • main

dkd-kaehm added a commit to dkd-kaehm/ext-solr that referenced this issue Nov 8, 2022
`SiteUtility::getConnectionProperty()` method must handle mixed types.

Fixes: TYPO3-Solr#3394
dkd-kaehm added a commit to dkd-kaehm/ext-solr that referenced this issue Nov 8, 2022
`SiteUtility::getConnectionProperty()` method must handle mixed types.

Fixes: TYPO3-Solr#3394
dkd-kaehm added a commit to dkd-kaehm/ext-solr that referenced this issue Nov 8, 2022
`SiteUtility::getConnectionProperty()` method must handle mixed types.

Fixes: TYPO3-Solr#3394
Ports: TYPO3-Solr#3396
dkd-kaehm added a commit that referenced this issue Nov 9, 2022
`SiteUtility::getConnectionProperty()` method must handle mixed types.

Fixes: #3394
Ports: #3396
dkd-kaehm added a commit that referenced this issue Nov 9, 2022
`SiteUtility::getConnectionProperty()` method must handle mixed types.

Fixes: #3394
dkd-kaehm added a commit that referenced this issue Nov 9, 2022
`SiteUtility::getConnectionProperty()` method must handle mixed types.

Fixes: #3394
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.

2 participants