For some strings the domain id will be negative, causing errors when assigning nodes to domains.
The code that causes it is in Drupal\domain\Entity\Domain:

public function createDomainId() {
    // We cannot reliably use sequences (1, 2, 3) because those can be different
    // across environments. Instead, we use the crc32 hash function to create a
    // unique numeric id for each domain.
    $this->domain_id = (int) crc32($this->getHostname());
  }
 

I think another hash function is needed.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jurcello created an issue. See original summary.

jurcello’s picture

A very simple patch which ensures the id is positive. Although there is a possibility now for getting the same id twice, this possibility is very very small.

jurcello’s picture

Status: Active » Needs review
jurcello’s picture

And the patch that actually can be applied.

zerolab’s picture

Looks good to me.

Can you open a Pull Request at https://github.com/agentrickard/domain?

agentrickard’s picture

Status: Needs review » Reviewed & tested by the community

Wow. What systems?

That is a nice catch.

agentrickard’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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