Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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 CreditAttribution: jurcello for Media.Monks 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 CreditAttribution: jurcello for Media.Monks commentedComment #4
jurcello CreditAttribution: jurcello for Media.Monks commentedAnd the patch that actually can be applied.
Comment #5
zerolab CreditAttribution: zerolab at Torchbox 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