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.
Problem/Motivation
On my system (Mac with PHP 5.5.29 from homebrew) the Pecl UUID implementation is used and it produces UUIDs in uppercase, like 86AF9163-9980-4DD2-A7D3-D48515F82551. This is however not valid according to Uuid::isValid() which requires lowercase.
Proposed resolution
strtolower() the result of uuid_create() in Uuid\Pecl?
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#18 | 2613926-18.patch | 442 bytes | jofitz |
#2 | pecl-uuid-2613926-2.patch | 440 bytes | Arla |
Comments
Comment #2
ArlaLike this.
I guess we cannot have tests for this because the PECL package is optional.
Comment #3
BerdirSee also #2576331: Uuid::isValid() is broken with uppercase letters.
Discussed this a bit with alexpott and while technically, according to the standard, the case doesn't really matter (it says the canonical form is lowercase but also that case should be ignored on input).
However, we store UUID's in string fields in the database. This could break on postgresql/sqlite and result in not matching a generated UUID if someone lowercased it.
Lets be on the safe side then and change this.
Comment #4
cilefen CreditAttribution: cilefen commentedI closed #2576331: Uuid::isValid() is broken with uppercase letters as a duplicate of this.
Comment #5
mbovan CreditAttribution: mbovan at MD Systems GmbH commentedSeems fine. Changing to RTBC.
Comment #6
tstoecklerThis makes sense, I think. We should document that we are implementing this behavior. But because the behavior of Uuid::isValid() is not changed here, I opened a separate issue for that: #2625142: Document that Uuid::isValid() only considers lowercase UUIDs as valid
Comment #7
catchDoes this need an upgrade path for uuids that have already been created?
Comment #8
hass CreditAttribution: hass commentedHow should this work if I need to integrate with 3rd party code that may generate valid uuid's, but invalid for drupal? E.g. Webservices can return this to me and than I need to save as is as it is a unique reference in a remote system that is not in my hand.
Comment #9
hass CreditAttribution: hass commentedComment #10
Arla@hass: I hope my comment #2625142-14: Document that Uuid::isValid() only considers lowercase UUIDs as valid is an accurate reply to your question. Unlike @tstoeckler, I think that discussion belongs in that other issue.
#7: I'm not sure about upgrade path. If I am correct in #2625142-14: Document that Uuid::isValid() only considers lowercase UUIDs as valid when saying that the validator is only used for newly generated uuids, then I see no need to update old uuids. Also, I'm pretty sure changing the case of existing uuids could break something that relies on uuids as references, in contrib or elsewhere.
Comment #15
juves CreditAttribution: juves commentedHello
How can I edit blocks machine-readable names if they contain uppercase letters?
e.g. page title block was created with a name "Sitename_page_title" and I can't change any block settings, i receive an error "machine-readable name cannot contain uppercase letters"
UPD // sorry, it's theme related, i can edit block settings in Bartik.
Comment #17
anavarreComment #18
jofitz CreditAttribution: jofitz at ComputerMinds commentedRe-roll.
Comment #28
smustgrave CreditAttribution: smustgrave at Mobomo commentedThis issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request as a guide.
If still a valid bug in D10 it will need a test case to show it please
Thanks!
Comment #29
catchI think we can skip tests here, there's not really a bug as such, we're just normalizing something to lowercase. To write test coverage we'd need to know PECL is always including upper case characters when it generates a UUID, but it might not every time so the test could easily have false negatives.