Cms: Out of order project config updates can result in error

Created on 6 Jun 2019  路  2Comments  路  Source: craftcms/cms

Description

When changing unique properties of multiple existing elements, project config can fail if there's a value collision and the changes are processed out of order. See reproduction steps for a better explanation.

Difficult to protect against unless the order of PC edits is tracked or failed updates are retried after any other updates in the queue have been successfully applied (but this might end up causing a mess depending on if updates can be nested).

Steps to reproduce

  1. With PC enabled locally create sections called section1 and section2
  2. Push to remote and sync PC
  3. Locally change section handles section2 to section3, then section1 to section2
  4. Push to remote and sync PC

:boom: Applying changes from project.yaml ... error: Couldn鈥檛 save single entry due to validation errors on the slug and/or URI :boom:

#0 /var/www/html/vendor/craftcms/cms/src/services/Sections.php(1261): craft\services\Sections->_ensureSingleEntry(Object(craft\models\Section))
#1 /var/www/html/vendor/craftcms/cms/src/services/ProjectConfig.php(875): 

Additional info

  • Craft version: 3.1.26
  • PHP version: 7.3.6
  • Database driver & version: MySQL 5.5.5
bug project config normal

Most helpful comment

Just fixed this for the next release, using the same strategy that we used to fix #5510: now if a Single entry isn鈥檛 able to validate due to a duplicate URI, it will be saved as disabled instead, so URI uniqueness isn鈥檛 validated.

All 2 comments

Just fixed this for the next release, using the same strategy that we used to fix #5510: now if a Single entry isn鈥檛 able to validate due to a duplicate URI, it will be saved as disabled instead, so URI uniqueness isn鈥檛 validated.

Craft 3.4.25 is out now with the fix.

Was this page helpful?
0 / 5 - 0 ratings