blog icon indicating copy to clipboard operation
blog copied to clipboard

explode() - string required, int passed

Open NamelessCoder opened this issue 2 years ago • 2 comments

Bug Report

Prerequisites

  • [ ] Can you reproduce the problem on TYPO3 v9.5 LTS
  • [ ] Can you reproduce the problem on TYPO3 v10.4 LTS
  • [x] Can you reproduce the problem on PHP 8.x
  • [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

NamelessCoder avatar Jan 15 '24 10:01 NamelessCoder

I just patched the GeneralUtility for it:

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

DavidBruchmann avatar Mar 21 '24 01:03 DavidBruchmann

Just proposed a PR with exactly this fix.

mbrodala avatar May 22 '24 09:05 mbrodala