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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Arla created an issue. See original summary.

Arla’s picture

Status: Active » Needs review
FileSize
440 bytes

Like this.

I guess we cannot have tests for this because the PECL package is optional.

Berdir’s picture

See 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.

cilefen’s picture

mbovan’s picture

Status: Needs review » Reviewed & tested by the community

Seems fine. Changing to RTBC.

tstoeckler’s picture

This 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

catch’s picture

Status: Reviewed & tested by the community » Needs review

Does this need an upgrade path for uuids that have already been created?

hass’s picture

How 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.

hass’s picture

Status: Needs review » Needs work
Arla’s picture

Status: Needs work » Needs review

@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.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

juves’s picture

Hello

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.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

anavarre’s picture

Title: The Pecl UUID implementation can return invalid uuids » The PECL UUID implementation can return invalid UUIDs
Version: 8.5.x-dev » 8.6.x-dev
Issue tags: +PECL, +UUID, +Needs reroll
jofitz’s picture

Issue tags: -Needs reroll
FileSize
442 bytes

Re-roll.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative, +Needs tests

This 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!

catch’s picture

Issue tags: -Needs tests

I 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.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.