Problem/Motivation

Splitting this issue from #2998103: dblog_update_8600() breaks views.view.watchdog config entity, leading to PHP warning on admin/reports/dblog and configuration import errors

That issue was covering 2 problems that appear to happen in the update 8.6.0 and possibly involving dblog_update_8600() and a site was installed with a language beside English

  1. The user simply went to admin/reports/dblog and encountered an error
  2. The user tries to edit the watchdog View at admin/reports/dblog and encountered an error

this issue will cover #2

Steps reproduce

  1. git checkout 8.5.5
  2. drush sql-drop
  3. rm -rf vendor && composer install
  4. drush si standard --account-pass=admin --locale=es
  5. sign-in in the web
  6. git checkout 8.6.0
  7. rm -rf vendor && composer install
  8. run update.php via web
  9. goto admin/reports/dblog
  10. edit and save the view

The last step will get the error

El sitio web encontró un error inesperado. Vuelva a intentarlo más tarde.InvalidArgumentException: Placeholders must have a trailing [] if they are to be expanded with an array of values. in Drupal\Core\Database\Connection->expandArguments() (line 729 of core/lib/Drupal/Core/Database/Connection.php).

Drupal\Core\Database\Connection->query('UPDATE {locales_target} SET translation=:db_update_placeholder_0, customized=:db_update_placeholder_1
WHERE (lid = :db_condition_placeholder_0) AND (language = :db_condition_placeholder_1)', Array, Array) (Line: 148)
I step debugged this and interestingly I think in this case it because dblog_update_8600() did not update the view. Because dblog_update_8600 has

  // Only update the empty text if is untouched from the original version.
  if ($empty_text['area']['id'] == 'area' &&
      $empty_text['area']['plugin_id'] == 'text' &&
      $empty_text['area']['field'] == 'area' &&
      $empty_text['area']['content']['value'] == 'No log messages available.') {

The last condition does not pass when installing in Spanish $empty_text['area']['content']['value'] == 'No log messages available.' will not true because this actually has the Spanish translation.

Proposed resolution

This can be repaired from the UI. It may be easier to do if one has the configuration export of views.view.watchdog.yml from before the upgrade. The following uses the default view.

1. Export view.view.watchdog.yml.
2. Find the empty section for the No results behavior. In the default config, in 8.5.5 it starts at line 656.

      empty:
        area:
          id: area
          table: views
          field: area
          relationship: none
          group_type: group
          admin_label: ''
          empty: true
          tokenize: false
          content:
            value: 'Nessun messaggio di log disponibile.'
            format: basic_html
          plugin_id: text

4. Delete the entire section, include the 'empty:'.
5. Import the config
6. Now add back the empty section, with some modifications. These are 'id', 'field', 'admin_label', 'content' and 'plugin_id'. If you have not customized this part of the view then use the following. If it was customized, then changing these fields should enable you to use the UI to make further changes.

      empty:
        area:
          id: area_text_custom
          table: views
          field: area_text_custom
          relationship: none
          group_type: group
          admin_label: 'Nessun messaggio di log disponibile.'
          empty: true
          tokenize: false
          content: 'Nessun messaggio di log disponibile.'
          plugin_id: text_custom

7. Import the config.
8. Do not remove and re-add this plugin. If you do there will be errors in the log. You can follow these steps again.

Remaining tasks

TBD

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

None

Comments

tedbow created an issue. See original summary.

tedbow credited dagmar.

tedbow’s picture

Crediting the steps to reproduce were from a version listed(slightly edit because I couldn't reproduce exactly)

catch’s picture

Priority: Normal » Major

Given this is reproducible via the UI, upgrading to major.

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.

dakwamine’s picture

I have had trouble to update better_exposed_filters due to this watchdog view (the update itself changes nothing, it just resaves it as is). I have had to debug by throwing exceptions in the drush output and sending the output to a file to check the diff. dump(), echo and Xdebug were not working. Very bad developer experience.

I have replaced some values of the views.view.watchdog.yml config with the original one in the config/optional directory:

diff --git a/src/config/sync/views.view.watchdog.yml b/src/config/sync/views.view.watchdog.yml
index b08c496..b02d5ee 100644
--- a/src/config/sync/views.view.watchdog.yml
+++ b/src/config/sync/views.view.watchdog.yml
@@ -658,18 +658,16 @@ display:
       footer: {  }
       empty:
         area:
-          id: area
+          id: area_text_custom
           table: views
-          field: area
+          field: area_text_custom
           relationship: none
           group_type: group
-          admin_label: ''
+          admin_label: 'Aucune entr<C3><A9>e du journal n''est disponible.'
           empty: true
           tokenize: false
-          content:
-            value: 'Aucune entr<C3><A9>e du journal n''est disponible.'
-            format: basic_html
-          plugin_id: text
+          content: 'Aucune entr<C3><A9>e du journal n''est disponible.'
+          plugin_id: text_custom
       relationships:
         uid:
           id: uid

Please notice that the website is in french language.

How can we fix this error on a live site with cmi?

The fix must run with a high priority, before any other update working on this view.

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.

quietone’s picture

Issue tags: +8.6.0 update

Tagging

quietone’s picture

Issue summary: View changes
Status: Active » Needs review

I was able to reproduce this problem with the steps in the IS. I then tested and confirmed that this can be fixed via the UI and added the steps to the Issue Summary.

quietone’s picture

After testing over in #2998103: dblog_update_8600() breaks views.view.watchdog config entity, leading to PHP warning on admin/reports/dblog and configuration import errors I am not so sure about this. I tried the fix I suggested and it it didn't prevent the error but the patch in the other issue did.

quietone’s picture

Issue summary: View changes

Tweaking the work around in the IS.

quietone’s picture

Status: Needs review » Closed (duplicate)

I am closing this as a duplicate of the issue it was original split off from. They are very much tied together and the fix is the same.

If that is wrong, reopen the issue, by setting the status to 'Active', and add a comment.

Thanks!

quietone’s picture

Issue tags: +Bug Smash Initiative

Forgot to tag