You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a Blueprint's slug field is a linked field, e.g. a field defined in a common fieldset used in many places, the AddUniqueSlugValidation update script added in #3671 breaks.
Deep in the Blueprint class there's an array_merge() being called on the field key in the config, but on linked fields field is a string with the name of the original fieldset and field, so you get a TypeError: array_merge(): Argument #1 must be of type array, string given.
How to Reproduce
Have a Statamic site on a version old enough to need to run that upgrade script, e.g. 3.1.18.
Have a slug field in a fieldset.
Have a Blueprint with that slug field linked, something like this:
This method is being called from ensureFieldHasConfig() in the same class, which in turn is being called from the updateBlueprint() method in the AddUniqueSlugValidation update script.
In my case, the $existingConfig argument to array_merge() ends up being 'common.slug' which causes the error.
Environment
Statamic 3.1.23 Pro (3.1.18 before running the script) Laravel 8.47.0 PHP 8.0.7
No addons installed
Install method (choose one):
Fresh install from statamic/statamic I think
The text was updated successfully, but these errors were encountered:
For what it's worth, it's not the end of the world if that doesn't run. If you do want slugs to be unique, you can manually add a unique_entry_value:{collection},{id},{site} validation rule. (Although from how detailed this issue is, I'm sure you worked that out.)
Bug Description
If a Blueprint's
slug
field is a linked field, e.g. a field defined in acommon
fieldset used in many places, theAddUniqueSlugValidation
update script added in #3671 breaks.Deep in the
Blueprint
class there's anarray_merge()
being called on thefield
key in the config, but on linked fieldsfield
is a string with the name of the original fieldset and field, so you get a TypeError:array_merge(): Argument #1 must be of type array, string given
.How to Reproduce
slug
field in a fieldset.slug
field linked, something like this:composer update
and eventually get a TypeError.Extra Detail
The error comes from line 470 of
Statamic\Fields\Blueprint
inside theensureFieldInSectionHasConfig()
method:cms/src/Fields/Blueprint.php
Lines 466 to 472 in 9aa7a52
This method is being called from
ensureFieldHasConfig()
in the same class, which in turn is being called from theupdateBlueprint()
method in theAddUniqueSlugValidation
update script.In my case, the
$existingConfig
argument toarray_merge()
ends up being'common.slug'
which causes the error.Environment
Statamic 3.1.23 Pro (3.1.18 before running the script)
Laravel 8.47.0
PHP 8.0.7
No addons installed
Install method (choose one):
statamic/statamic
I thinkThe text was updated successfully, but these errors were encountered: