There is a bug in URL alias AliasStorage for Drupal core version 8.6 & 8.7

On path update, the "pid" is set to the affected rows return value, which is "1" not the actual path id.

This means the alias save return value and also hook_path_update gets the incorrect path id value of "1"

https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Path%21Al...

Previously, in 8.5 the $fields['pid'] = $pid; was set before the path update query:

https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Path%21Al...

Patch pending.

Comments

davidwhthomas created an issue. See original summary.

davidwhthomas’s picture

StatusFileSize
new743 bytes

Here's the patch

davidwhthomas’s picture

Issue summary: View changes
davidwhthomas’s picture

Status: Active » Needs review
davidwhthomas’s picture

Issue summary: View changes
davidwhthomas’s picture

Issue summary: View changes
longwave’s picture

Note that path aliases were converted to entities in #2336597: Convert path aliases to full featured entities so this appears to be no longer an issue in 8.8.x onwards, and 8.7.x is no longer receiving patch releases (except security issues) so it is unlikely this will be fixed here.

davidwhthomas’s picture

Yes, it's presumably fixed in 8.8 but 8.6 and the current Drupal 8.7.x version shipped for download here https://www.drupal.org/download has the bug.

We're using the fix with v8.6.
The patch can be applied manually if needed in composer.json e.g:

    "extra": {
        "patches": {
          "drupal/core": {
            "Path update pid fix": "patches/3095545-path-update-pid-fix.patch"
          },

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

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Branches prior to 8.8.x are not supported, and Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should 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: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev
tinto’s picture

Status: Needs review » Closed (outdated)
Issue tags: +Bug Smash Initiative

Marking this as closed (outdated). This issue was fixed by the changes committed to 8.8.x, when paths were converted to entities. See: #2336597: Convert path aliases to full featured entities.