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.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | domain-negative-id-2794047-4-D8.patch | 631 bytes | jurcello |
| #2 | domain-negative-id-2794047-2-D8.patch | 727 bytes | jurcello |
Comments
Comment #2
jurcello commentedA 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.
Comment #3
jurcello commentedComment #4
jurcello commentedAnd the patch that actually can be applied.
Comment #5
zerolab commentedLooks good to me.
Can you open a Pull Request at https://github.com/agentrickard/domain?
Comment #6
agentrickardWow. What systems?
That is a nice catch.
Comment #7
agentrickard