Issue Bug Closed

#106314f:split ViewHelper causes an exception

Wolfgang Wagner 03/05/25, 19:30 updated 12/02/25, 14:22

Description

Error occurs in TYPO3 v12 and v13.

Code from the documentation:

<f:split value="1,5,8" separator="," />

Error:

1/1) #1698750868 TYPO3Fluid\Fluid\Core\Parser\Exception
Cannot cast an array to string.

in /var/www/html/vendor/typo3fluid/fluid/src/Core/Parser/SyntaxTree/AbstractNode.php line 72
        if (is_object($value) && !method_exists($value, '__toString')) {
            throw new Parser\Exception('Cannot cast object of type "' . get_class($value) . '" to string.', 1273753083);
        }
        if (is_array($value)) {
            throw new Parser\Exception('Cannot cast an array to string.', 1698750868);
        }
        $output = (string)$value;
        return $output;
    }
at TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\AbstractNode->castToString()

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

History 3

  1. Garvin Hicking commented and changed category <span data-processor="relativetime" data-value="2025-03-05T21:12:14+00:00" > 03/05/25, 21:12 </span>

    (I think we’ll need to move this to fluids github issue tracker ?)

  2. Simon Praetorius commented and changed status New Resolved <span data-processor="relativetime" data-value="2025-03-05T21:43:29+00:00" > 03/05/25, 21:43 </span>

    The example has been clarified in the Fluid documentation:

    https://github.com/TYPO3/Fluid/pull/1038
    https://docs.typo3.org/other/typo3fluid/fluid/main/en-us/ViewHelpers/Fluid/Split.html

    This will propagate to the TYPO3 ViewHelper reference as well once the next version of Fluid Standalone is released and integrated into the core.