When a block has existing role visibility, executing a pattern against that block fails if there is no roles: block specified.

Example:

  # account settings button
  - tag: block
      id: spawar_support-2
      theme: felice
      visibility: 1
      pages: 
        - node/*

On a block with 3 existing permissions, running this pattern results in the 3 existing roles being deleted, and the anonymous user role being selected instead.

An error message is produced:

Pattern blah blah (profiles/collab/patterns/blahbah.yaml)
Action #1: Block: Configure block (op "execute")
PHP error occured:
user warning: Duplicate entry 'spawar_support-2-1' for key 1 query: INSERT INTO blocks_roles (rid, module, delta) VALUES (1, 'spawar_support', '2') in /var/www/versions/blocks/core/modules/block/block.admin.inc on line 279.

The attempted insertion into blocks_roles is indeed correct to fail, as the permission already exists; I'm not sure why it's trying to insert it again.

Comments

sarvab’s picture

Status: Active » Fixed

This should be fixed now from the changes in #434870: Empty set of block roles?

However if you still have problems, it is possible that an unstable state has crept into the blocks table where it is setting the region value to "" that is causing problems for that form. (the block submit handler expects region to be set 100% of the time and it wasn't being set in the previous state of patterns)

Setting the region in the blocks table for problem blocks should fix it.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.