Configuration update throws error trying to delete menus

Created on 6 July 2023, 12 months ago
Updated 1 May 2024, about 2 months ago

Problem/Motivation

I'm seeing an issue on a config split site. If I uninstall devel, views_natural_sort_entity_delete triggers, throwing this SQL error:

SQLSTATE[22007]: Invalid datetime format: 1292 Truncated incorrect DOUBLE value: "devel": DELETE FROM "views_natural_sort"

It looks like deleting devel via config passes in a Drupal/system/entity/Menu object to views_natural_sort_entity_delete, which expects a numeric eid.

Steps to reproduce

Presumably:
Install views_natural_sort
Do a config export.
Install devel
Do a config import (which should uninstall devel)

Proposed resolution

Check views_natural_sort_entity_delete for a numeric eid before attempting to delete the row.

Patch incoming.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada TrevorBradley

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @TrevorBradley
  • πŸ‡ΊπŸ‡ΈUnited States generalredneck

    @TrevorBradley,

    So I'm having a really hard time replicating the error message locally. I don't doubt what you say about it being a string against an int comparison... but I'm not able to reproduce it, even following your steps to the letter. Moreover, I've validated that doing something like

        $menu = \Drupal::entityTypeManager()->getStorage('menu')->create([
          'id' => 'menu_test',
          'label' => 'Test Menu',
          'description' => 'VNS Test Menu',
        ]);
        $menu->save();
        $menu->delete();
    

    Does in fact hit the views_natural_sort_remove() function. but just returns back 0 for me.

    I'm going to go a bit of a different direction than you did. Ideally the delete code would use the same check as the logic for the insert code which includes a little more than JUST numeric id check. Should reduce some Database traffic and make the module just ever so slightly faster.

  • Status changed to Needs review 12 months ago
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.3 & MySQL 5.7
    last update 12 months ago
    8 pass
  • πŸ‡ΊπŸ‡ΈUnited States generalredneck

    @TravorBradley,

    You mind giving this a shot? My tests show it to work.

  • πŸ‡¨πŸ‡¦Canada TrevorBradley

    @generalredneck - this is on my radar, but I won't be able to look at it until Monday at the earliest.

    Thank you!

  • πŸ‡¨πŸ‡¦Canada TrevorBradley

    @generalredneck - testing now...

    On my local:

    Remove my -2 patch from composer.json

    Switch back and forth between my local and prod config split environments to replicate the problem...

    Verified, the problem is still there. Going from local to production:

      SQLSTATE[22007]: Invalid datetime format: 1292 Truncated incorrect DOUBLE value: 'devel': DELETE FROM "views_natural_sort"
      WHERE ("eid" = :db_condition_placeholder_0) AND ("entity_type" = :db_condition_placeholder_1); Array
      (
          [:db_condition_placeholder_0] => devel
          [:db_condition_placeholder_1] => menu
      )

    Adding -4 patch.

    Switch back and forth between my local and prod config split environments to replicate the problem...

    Works great! I can verify the #4 patch is a good replacement for my #2 patch.

  • Status changed to RTBC 12 months ago
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.3 & MySQL 5.7
    last update 12 months ago
    8 pass
  • Status changed to Fixed 12 months ago
  • πŸ‡ΊπŸ‡ΈUnited States generalredneck

    It is done!

    Thanks for all the help on the multiple issues Trevor.

  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Status changed to Fixed 2 months ago
  • πŸ‡¨πŸ‡΄Colombia fabiansierra5191

    I can confirm that patch #4 fixed the issue and was committed to the 8.x-2.x branch but it's not part of the last release so I'd say this issue should be Open or Reviewed by the community but the fixed status is not the right one.

  • πŸ‡ΊπŸ‡ΈUnited States generalredneck

    Fabinasierra,

    I see you are frusturated. By the definition of fixed β†’ in the D.O Documentation this issue is a part of the dev release.

    I do hear your concern though, and I think what you are trying to say is that there wasn't a tagged release fixing this issue in an easy way someone doing a composer update and get the fix without having to go find it in the dev version.

    With that I can only say I'm sorry to have caused you problems. I will try to get an additional release out to hopefully ease the frustration of others. I'm sorry it wasn't there to help you.

  • πŸ‡ΊπŸ‡ΈUnited States generalredneck

    This now part of 8.x-2.0alpha8 β†’ .

  • πŸ‡¨πŸ‡΄Colombia fabiansierra5191

    Hi Allan, I'm just a bit frustrated but thanks for the new release.. I'll update the module.

Production build 0.69.0 2024