cms
cms copied to clipboard
Wrong return type of parse and parseLoop functions
Bug description
The parse() and parseLoop functions in vendor/statamic/cms/src/Tags/Tags.php return an array when $this->parser is false. Resulting in array to string conversions while using blade.
How to reproduce
Run the parse functions without a parser.
Logs
No response
Versions
Statamic 3.3.16 Pro Laravel 8.83.6 PHP 8.1.7 doublethreedigital/simple-commerce 3.2.11 edalzell/blade-directives 3.7 spatie/statamic-responsive-images 2.12.3
Installation
Fresh statamic/statamic site via CLI
Antlers Parser
No response
Additional details
Returning an empty string should be fine.
Can you be more specific with your problem? Which tag is giving your an issue?
After update 3.3.14 the Statamic::tag('{tag}')->fetch() causes this error.
In vendor/statamic/cms/src/Tags/FluentTag.php inside the fetch() function there is a call to the load() function. In the parameters for this function the 'parser' parameter is now null.
That means whenever it reaches the parse() function in src/Tags/Tags.php it will return the $data because the $this->parser is false, and this causes a array to string conversion error because the return is expected to be a string.
If this isn't specific enough i will create a repo somewhere tomorrow to give you a better example, let me know :)
I understand that, but which tag are you using? A custom one?
I'm going to close this issue since it's been open for over a year and there hasn't been a response to the last comment.
However, if you're still having issues with this and you're able to provide steps to reproduce, then feel free to re-open.