blog icon indicating copy to clipboard operation
blog copied to clipboard

Normalize category storage PID on TYPO3v12

Open mbrodala opened this issue 1 year ago • 5 comments

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

mbrodala avatar May 22 '24 09:05 mbrodala

This patch solves the issue for the CategoryRepository, however we have the same issue in the PostRepository

linawolf avatar Jul 16 '24 06:07 linawolf

normalizePost.patch

Attached patch also solves this for the PostRepository

linawolf avatar Jul 16 '24 06:07 linawolf

Thanks, I've refreshed the PR, included your change and also did the same for the TagRepository.

mbrodala avatar Jul 16 '24 07:07 mbrodala

@mbrodala your solution would still fail if the setting contained a non-scalar value like an array. It would be safer to test if it is set to a scalar value as I did in my patch, first.

linawolf avatar Jul 16 '24 10:07 linawolf

That is something left to do in case TYPO3 ever supports this. Right now it can only be a string, the implicit conversion to a number could be considered a unintended side-effect.

Do you have an example where storagePid could be an array?

mbrodala avatar Jul 16 '24 10:07 mbrodala