Clicking the 'Compare' button on the 'Revisions' page of a node gives me an HTTP 500 Internal Server Error. The Drupal Log shows me:

Type: php
Location: http://[anonymized]/node/142/revisions
Referrer: http://[anonymized]/node/142/revisions
Message: Symfony\Component\Routing\Exception\InvalidParameterException: Parameter "filter" for route "diff.revisions_diff" must match "[^/]++" ("" given) to generate a corresponding URL. in Drupal\Core\Routing\UrlGenerator->doGenerate() (line 193 of /home/[anonymized]/public_html/core/lib/Drupal/Core/Routing/UrlGenerator.php).
Severity: Error

Comments

dhendriks created an issue. See original summary.

miro_dietiker’s picture

Did you run the db update?

dhendriks’s picture

Yes, there are no database updates outstanding.

johnchque’s picture

Do you have the Visual Inline plugin enabled? Have you installed the dependencies? Can you try going to settings and change the order of the layout plugins to see if this fix it? If so, please tell us if the "Visual Inline" was enabled or not.

dhendriks’s picture

1) So, the issue is caused by not having any layout plugins enabled. I did run the database updates before, and thought that should have enabled all of them, but apparently it didn't. May there is an issue in the update code?

2) Turning them all on, diffs now works again. Maybe not having any diff plugins enabled should use a default as fallback, or give an error message that diffs can't be displayed due to a configuration issue, or so. An HTTP 500 Internal Server Error in that case may not be the best user feedback. Maybe the problem of not having any layout plugins enabled should be listed on the Drupal Status Report page? It should definitely be indicated on the actual diff pages that can't show actual diffs, instead of an HTTP 500 error.

3) And while we're at it, is there any description/documentation about what the different layout plugins do? If not, maybe a separate issue should be created for this?

dhendriks’s picture

Just a quick follow up. I checked my database backups for the diff configuration. Before the update I was at 8.x-1.0-alpha5, diff was working, and I had the following configuration:

  layout_plugins:
    single_column:
      enabled: true
    classic:
      enabled: true

After updating to 8.x-1.0-beta1 and applying the database update, I still had that configuration. Only after going to the settings page and enabling all layout plugins, reordering them, and saving that, did I get the following configuration:

  layout_plugins:
    split_fields:
      enabled: true
      weight: -50
    unified_fields:
      enabled: true
      weight: -49
    visual_inline:
      enabled: true
      weight: -48

It thus seems that, at least for me, the database update did not work (it did not have any effect).

toncic’s picture

Issue summary: View changes
StatusFileSize
new175.53 KB
new235.61 KB

I also reproduced this error. And also I got error in settings. I am providing screenshot for both.

johnchque’s picture

there must be an error in the update function. Needs to be investigated.

johnchque’s picture

Assigned: Unassigned » johnchque

I just found the problem. Will upload a patch soon.

johnchque’s picture

Status: Active » Needs review
StatusFileSize
new1016 bytes

Actually there was a problem with the 8005 function, it didn't clear the cached definitions of the plugins, so it was setting the old ones again. Added a new update function, removed the previous one. :)

miro_dietiker’s picture

Status: Needs review » Fixed
Issue tags: -500 internal server error

Committed, thx! :-)

Dropped the state line as it's unused. Empty functions are fine.

dhendriks’s picture

Actually, the problem can still occur. If I manually disable all layout plugins and save the diff configuration, the problem reappears. I think it would be good to:

1) Disallow saving the configuration if all layout plugins have been disabled, by means of form validation.

2) Give a better error message when a diff is produced and no layout plugins are active. This is redundant, but better safe than sorry, should they all become inactive for some other reason.

What do you think?

johnchque’s picture

I think the validation is need, thus created follow up. #2805249: Validate layout plugins when disabling all

Status: Fixed » Closed (fixed)

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

rakesh.gectcr’s picture

StatusFileSize
new1.53 KB

So sorry, Still I am able to reproduce this error, And I need to update the same on 15+ sites, in all the three environments.

The reason behind the problem, because of the update hook diff_update_8006() is not getting updated. So I created that as drush service. And solves my problem. Still, If there is anyone facing the same problem, this will be helpful

Steps to resolve:

  1. Apply the patch throug composer
  2. Go to the terminal and run drush cc drush
  3. then run drush diff_uplks or drush diff_update_layout_keys
rolandoscott’s picture

I had this issue recently.. patch and instructions above worked for me with Drupal 9.5.10 and Diff 8.x-1.1

heikkiy’s picture

I encountered a bit similar issue with a multisite.

I did the following steps which caused the error.

1. Enabled Diff and configured it in site A.
2. Exported all changed configs with drush cex.
3. Copied the new configurations to a site B
4. Run drush cim which enabled Diff and imported the related configs.
5. When trying to compare revisions, I got the same error as in this issue.

Also the settings page for Diff was broken and it was missing all the needed settings. In my case I was able to fix it by removing the configs and importing configs again which uninstalled Diff. After that I was able to install the module with Drush and all the settings appeared correctly.

It seems like installing the module from configurations is missing possible some database update step.