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

explode() - string required, int passed #301

Open
2 of 4 tasks
NamelessCoder opened this issue Jan 15, 2024 · 2 comments · May be fixed by #312
Open
2 of 4 tasks

explode() - string required, int passed #301

NamelessCoder opened this issue Jan 15, 2024 · 2 comments · May be fixed by #312

Comments

@NamelessCoder
Copy link

NamelessCoder commented Jan 15, 2024

Bug Report

Prerequisites

  • Can you reproduce the problem on TYPO3 v9.5 LTS
  • Can you reproduce the problem on TYPO3 v10.4 LTS
  • Can you reproduce the problem on PHP 8.x
  • Did you perform a cursory search to see if your bug or feature is already reported?

Description

GeneralUtility::intExplode is called from CategoryRepository with $this->settings['persistence']['storagePid'] as argument, but this value is an integer on TYPO3v12 due to the new TS parser. On PHP 8.x this causes an error because explode() no longer silently accepts integers as input.

Also happens in:

  • PostRepository::getStoragePidsFromTypoScript

Steps to Reproduce

  1. Install the extension
  2. Insert the "list" plugin on a page
  3. Load the page in FE

Expected behavior: Obviously, no exceptions thrown.

Actual behavior: Exception thrown.

Versions

  - Locking t3g/blog (12.0.2)

image

@DavidBruchmann
Copy link

I just patched the GeneralUtility for it:

- $result = explode($delimiter, $string);
+ $result = explode($delimiter, (string) $string);

mbrodala added a commit to mbrodala/blog that referenced this issue May 22, 2024
The new TypoScript parser introduced in TYPO3v12 yields a regular integer in case of a single storagePid. Only in case of a CSV this will be a string. This in turn leads to explode() failing with a type error in the integer case.

Fix this by normalizing the setting value to string.

Fixes: TYPO3GmbH#301
@mbrodala mbrodala linked a pull request May 22, 2024 that will close this issue
@mbrodala
Copy link
Contributor

Just proposed a PR with exactly this fix.

mbrodala added a commit to mbrodala/blog that referenced this issue Jul 16, 2024
The new TypoScript parser introduced in TYPO3v12 yields a regular integer in case of a single storagePid. Only in case of a CSV this will be a string. This in turn leads to explode() failing with a type error in the integer case.

Fix this by normalizing the setting value to string.

Fixes: TYPO3GmbH#301
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