Updating composer package today loaded the latest Symfony release v5.1.0 and Statamic stop working with this version.
run composer update
the error :
TypeError
Argument 2 passed to str_contains() must be of the type string, array given, called in [...]/vendor/statamic/cms/src/View/Antlers/Parser.php on line 1182
the error stack trace :

Statamic version: 3.0.0-beta.28
PHP version: 7.4.6
Install method: Fresh install from statamic/statamic
I'm seeing this too after a composer update this morning
The Statamic Parser.php does
str_contains($key, [':', '.'])
Which as far as I can see was never allowed in the PHP8 RFC for str_contains
(Symfony is just polyfilling PHP8 by the looks of things)
I fixed this by changing that line to:
if (! (str_contains($key, ':') || str_contains($key, '.'))) {
But there may be a more efficient way.
I think they should use Str::contains($haystack, $needles) instead.
@rosswintle / @jimblue can you confirm my suggestion works?
Just tried:
if (!(Str::contains($key, ':')) || Str::contains($key, '.')) {
return [false, null];
}
and
if (!(str_contains($key, ':') || str_contains($key, '.'))) {
return [false, null];
}
and both are working 馃憤
Looks like that new helper from Symfony gets loaded before Laravels. Neat.
Decent example why global functions aren鈥檛 a great idea.
For now, on Forge at least, a quick
sed -i 's/str_contains/Str::contains/g' vendor/statamic/cms/src/View/Antlers/Parser.php
right after composer install will patch this up.
Tks @jasonvarga ! 馃帀
To be fair, Laravel deprecated str_ and arr_ global functions a while ago, in favour of their Str and Arr classes respectively. Good change 馃憤
Most helpful comment
https://www.youtube.com/watch?v=E55t0lnp_8M