[5.x]: Team group saved without name and handle, so project-config/apply fails

Aperta Adatta ai principianti
#20,595 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@brandonkelly ci sta già lavorando.

Dal 12/11/2026.

  • #20625 di @brandonkelly — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
66/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
php
Ambito
backend, database

Direzione di ricerca

Inizia leggendo UserGroups::getTeamGroup(), UserPermissions::saveGroupPermissions() e UserGroups::handleChangedUserGroup(); l’issue indica che la mancanza di name e handle nella configurazione del progetto causa il problema. Riproduci il problema con i passaggi forniti per craft exec, poi esegui php craft project-config/apply --force per verificare che il problema segnalato sia risolto e che la configurazione del gruppo Team includa entrambi i campi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug repo:cms
What happened?
Description

On Craft 5.12.1 (Team), UserGroups::getTeamGroup() creates the Team group in the database only, not in the project config. It's also called from User::afterSave(). If permissions are then saved with UserPermissions::saveGroupPermissions(), the project config gets users.groups.<uid> with only permissions. The next project-config/apply (for example during a deploy) then fails.

Saving the Team permissions in Settings → Users is fine, because the controller calls saveGroup() first.

Steps to reproduce
  1. On a Team install, run this with craft exec:

    $pc = Craft::$app->getProjectConfig();
    $pc->remove('users.groups.c55ca0a9-4bd6-409b-afd8-c1884dafecd0'); // fresh state: no Team group
    $group = Craft::$app->getUserGroups()->getTeamGroup();
    Craft::$app->getUserPermissions()->saveGroupPermissions($group->id, ['viewusers']);
    

    The remove() simulates a Team install where the group exists only in the database.

  2. Look at config/project/users/groups/<uid>.yaml: it only has permissions.

  3. Run php craft project-config/apply --force.

Expected behavior

The Team group in the project config always has its name and handle, for example because getTeamGroup() saves the group through saveGroup(), or because saveGroupPermissions() makes sure the group exists in the project config. project-config/apply succeeds.

Actual behavior

project-config/apply fails with Undefined array key "name" in UserGroups::handleChangedUserGroup() (UserGroups.php:347).

Craft CMS version

5.12.1 (Team)

PHP version

8.5.12

Operating system and version

Debian GNU/Linux 13 (trixie), DDEV

Database type and version

MySQL 8.0.46

Image driver and version

Imagick 3.8.1 (ImageMagick 7.1.1-43)

Installed plugins and versions
Lingua principale
PHP
Stelle
3.6k
Fork
714
Merge medio
13h 20m
PR unite (30g)
471

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di craftcms/cms

Tutte le issue di craftcms/cms

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.