Problem/Motivation
dblog_update_8600() only runs properly on sites where English is the default language.
Where English is not the default language, it doesn't update the view properly. You can get either of these on the admin/reports/dblog.
Illegal string offset 'value' in Drupal\views\Plugin\views\area\Text
Placeholders must have a trailing [] if they are to be expanded with an array of values. in Drupal\Core\Database\Connection->expandArguments()
Steps to reproduce
- Install Drupal 8.5.5 in a non-English language
- Update to 8.6.0
Or modify config (perhaps when trying to fix this)
The only way for things to be broken is if the content key were changed and the id/plugin_id didn't, or vice versa.
In either the old or new set of config, nothing would be broken.
From #122
empty:
area:
id: area
table: views
field: area
relationship: none
group_type: group
admin_label: ''
empty: true
tokenize: false
content: 'Nessun messaggio di log disponibile.'
plugin_id: text
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 from a standard install of 8.5.5 in Italian.
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
Decide to patch or not.
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#69 | interdiff-69-66.txt | 515 bytes | TuWebO |
#69 | 2998103-69-complete.patch | 4.29 KB | TuWebO |
#66 | 2998103-66-complete.patch | 3.79 KB | TuWebO |
#63 | 2998103-63-test-only.patch | 2.55 KB | TuWebO |
#54 | watchdog-view-d8-emptyText.jpg | 152.61 KB | aiphes |
Comments
Comment #2
cilefen CreditAttribution: cilefen as a volunteer commentedComment #3
nils.destoop CreditAttribution: nils.destoop as a volunteer and at Wunder commentedI'm seeing the same error in my logs. It occurs when browsing to the watchdog page.
Comment #4
jmaties CreditAttribution: jmaties at Geekia commentedSame error, when browsing to the watchdog page.
Comment #5
quixxel CreditAttribution: quixxel commentedIn my case it occurs on /admin/reports/dblog.
Comment #6
cestmoi CreditAttribution: cestmoi commentedI'm getting similar error when I go to the reports page.
Not to mention the other major error I reported elsewhere. D 8.6.0 update seems to be a nightmare !
Comment #7
FiNeX CreditAttribution: FiNeX as a volunteer commentedEach time I visit the log page this error is added on the log since 8.6.0
Comment #8
XanoWe'll need to draft some instructions to reproduce this problem. Does it happen when installing 8.5 locally and upgrading it to 8.6 immediately?
Comment #9
cestmoi CreditAttribution: cestmoi commented@Xano
In my case, I noticed it after updating locally from 8.5.5 > 8.5.7 > 8.6.0 via composer
I also have a more serious error I reported elsewhere.
Comment #10
quixxel CreditAttribution: quixxel commentedMy sites are installed in an hosted environment and I upgraded them manually from 8.5.6 to 8.6.0 in that environment.
Comment #11
koenvandenbossche CreditAttribution: koenvandenbossche commentedSame error in my logs. It occurs when browsing to the watchdog page.
Comment #12
s.messaris CreditAttribution: s.messaris commentedI can see this error too when visiting the watchdog page.
$this->options['content']
inDrupal\views\Plugin\views\area\Text->preQuery()
is a string containing the "Watchdog is empty" text, while the code expects it to be an array with a 'value' key that contains the text.Comment #13
cilefen CreditAttribution: cilefen as a volunteer commentedComment #14
dagmarHi all. Sorry I wasn't aware of this issue until @cilefen moved to the right queue. Thanks!
For some context, this issue #2916898: Do not use basic_html text format for 'No log messages available.' message was created to update the filter used by the empty area plugin in the watchdog view.
I assume most of the people that reports this already ran the database updates, right? Also, if someone can attach the views.view.watchdog config entity as a txt in this issue, it will help me to understand what is going on here.
Comment #15
indigoxela CreditAttribution: indigoxela commentedDefinitely the "empty" setting in the view causes the errors.
Removing or replacing it manually solves the problem.
Here the relevant settings part to compare:
The problem addressed here seems to exist independently from any distribution (thunder was mentioned above). It even occurs on regular D8 installs without extra modules.
UPDATE: the above config parts are from an export over "/admin/config/development/configuration/single/export".
The first part after the core update before the manual change of the view (over views ui), the second part after the manual change of the view.
Comment #16
indigoxela CreditAttribution: indigoxela commentedComment #17
cestmoi CreditAttribution: cestmoi commented@indigoxela . I confirm your observation. Replacing the watchdog config yml file with the code from core d 8.6.x watchdog view .yml code fixed it for me.
Comment #18
indigoxela CreditAttribution: indigoxela commentedIt should be noted, that it's not necessary to touch any yml files on live sites.
The config parts are for dagmar, who asked for it for clarification.
For a fast fix on live sites it is easier and safer to edit the view.
On /admin/structure/views search for "watchdog" and edit the view as you would normally.
Comment #19
dagmarThe dblog_update_8600 that may be causing that problem.
Could someone please:
Thanks!
Comment #20
indigoxela CreditAttribution: indigoxela commentedAt least I can confirm that the update ran (drush updb).
On the status page there was no nagging about db updates, everything looked fine.
I didn't change anything on the watchdog views before the errors occurred. But now all are fixed. Would need to set up a new Drupal for a test.
Comment #21
cestmoi CreditAttribution: cestmoi commented@dagmar, I did the core update via composer (over two stages. It first updated from 8.5.5 to 8.5.7 and I had to edit the composer.json to make it update to d 8.6.0). I then did db update via
drush updatedb
If any more info may be of use, here's more details in another issue I created for another error.
@indigoxela, thanks for the hint
Comment #22
dagmarI tried to replicate this issue with a fresh install of drupal 8.5.5 and then update it to 8.6.1 without luck.
I wonder if the translation of the site is involved somehow on this. @indigoxela @cestmoi have you seen this issue in plain english sites?
Comment #23
cestmoi CreditAttribution: cestmoi commented@dagmar the site I experienced it on is multilingual actually and the default language is not En.
Comment #24
indigoxela CreditAttribution: indigoxela commented@dagmar interesting point - the language...
Do you think the problem is caused by "... $empty_text['area']['content']['value'] == 'No log messages available.'..." in the if clause of dblog_update_8600?
In none of my D8 installs the default language is en.
Just tested on german as default language with a fresh vanilla install of drupal-8.5.7, then updated to 8.6.0, then updated to 8.6.1 (not in one step).
Find attached the export of the watchdog config after updating to 8.6.1.
No errors occurred when updating db via "drush updb", no warnings on the status page afterwards.
Comment #25
quixxel CreditAttribution: quixxel commentedStrange behavior in the watchdog view (default language is german):
It's not possible to save the watchdog view.
On .../handler/watchdog/page/empty/area –> Behaviour if no results.....
in the global text area the content is only »K« instead of »Keine Protokollnachrichten verfügbar.«
If I correct this and try to save the view I get the error »An unexpected error ... «
and the error:
InvalidArgumentException: Placeholders must have a trailing [] if they are to be expanded with an array of values. in Drupal\Core\Database\Connection->expandArguments() (Zeile 729 in .../core/lib/Drupal/Core/Database/Connection.php).
Comment #26
quixxel CreditAttribution: quixxel commenteddeleted...
Comment #27
indigoxela CreditAttribution: indigoxela commentedVery likely it wasn't dblog_update_8600, as that one simply did nothing because of the language-bound if clause.
It seems to be something with tokens and non-ascii characters in the area (but not on unfiltered text).
To reproduce: Edit the empty setting, simply add an "Ü" (german umlaut) to the area and try to save it.
Anyone else experiencing this, any other findings?
Comment #28
quixxel CreditAttribution: quixxel commentedI tried all available variants of filters.
I tried to save only the »K« as it is, I tried »Ü« and ABCD...
but its not possible to save the view.
Always the error »InvalidArgumentException: Placeholders must...«
Comment #29
indigoxela CreditAttribution: indigoxela commented@quixxel if you are still searching for a fix on production sites: first delete the "empty" setting of watchdog view completely. If the view refuses to save, click on the "page" button on the top left of the view ui interface to reload the current page. Saving the view should be possible then.
If you would like to have an empty message, add a new "unfiltered text" (NOT text area) after that.
Comment #30
quixxel CreditAttribution: quixxel commented@indigoxela
Thx!
#29 works for me.
Comment #31
dagmarComment #32
DYdave CreditAttribution: DYdave at DAVYIN Internet Solutions / 戴文信息科技有限公司 commentedConfirming I'm having the same issue on a site, after updating to 8.6.1, multi-lingual setup.
Confirming, I'm seeing the same behavior described in #25.
Confirming #29 fixes the warning.
Not completely satisfied : Is this problem going to happen again for the next update ?
Ideally, I assume the problem should be fixed in the configuration files of the watchdog view ==> Problem will mostly likely happen again if the watchdog view configuration is reverted.
FYI. screenshot of the diff of the source and db configurations after carrying the changes from #29:
Hope this feedback will help a bit others and perhaps on the resolution of this issue.
Thanks everyone!
Comment #33
andypostComment #34
ivnish CreditAttribution: ivnish commentedThanks #29!
Comment #35
maxplus CreditAttribution: maxplus commentedThanks,
I removed the empty text from the watchdog view (admin/structure/views/view/watchdog)
Thanks #29 !
Comment #36
dagmarThere is no patch to review here yet. Assigning the right status.
Comment #37
Caralin CreditAttribution: Caralin as a volunteer and at ETECTURE GmbH commentedI also had this error on a site where the default language is German. (We had to change from English.)
I removed only the German configuration of empty and everything worked okay.
Another site with English as default language (also English / German) didn't have the issue at all.
Comment #38
indigoxela CreditAttribution: indigoxela commentedI'm trying to collect the actual strings for languages, that seem to be affected.
There must be a reason, why some are affected, while others aren't.
So far I have:
We see non-ascii characters in both translations, maybe this is causing the problem, maybe not.
There seems to be no central point to search for each and every available translation for an original string, at least I didn't find any.
This was my best guess:
https://localize.drupal.org/translate/languages
I searched for translations in several languages - some have only ascii (es/it/nb..) some have non-ascii chars included (sv/fi/cs...)
If one of you can confirm or refute my thesis, please post here.
Comment #39
Caralin CreditAttribution: Caralin as a volunteer and at ETECTURE GmbH commentedSince it was mentioned in this issue the error may be related to non-ascii characters, I actually tried to replace the text with
* Keine Protokollnachrichten vorhanden.
but that didn't work either.
Comment #40
Yazzbe CreditAttribution: Yazzbe as a volunteer commentedThanks #29 fixed it.
I have also a multilingual site + the empty views field was set to a custom text format (not the standard basic html)
Comment #41
indigoxela CreditAttribution: indigoxela commented@yazzybe I suppose, the default language is dutch. Is that right?
Let's skip the idea with non-ascii chars breaking stuff. The dutch translation is "Geen logberichten beschikbaar.".
What we have so far: As reported here by several people, the problem seems to occur on sites, where the default language is not english.
Single language or multilingual - both seem affected.
Very likely the initial installs were made with Drupal versions below 8.6.
At least this is the case with my own installs.
It IS possible to reproduce the InvalidArgumentException: described in #25 on sites for which the above is true (default language not en, installed before 8.6.).
Add an empty message text area to watchdog view with any text, format "basic_html", only ascii chars at first, save the view. No problem.
Edit the view again, add one "Ü".
No problem in the preview, but as soon as you try to save the view, the exception occurs.
To fix the exception, it is necessary to completely delete the empty message as described in #29. Just removing the umlaut won't help - you can't save the view.
Of course, as the view can't get saved, the actual error on the watchdog page "Illegal string offset 'value'..." is not reproducible.
Comment #42
Yazzbe CreditAttribution: Yazzbe as a volunteer commentedCorrect. The message in Dutch “Geen logberichten beschikbaar” has no special ascii characters.
I run 2 nearly identical drupal8 sites.
One had the watchdog problem, the other one didn’t. see attachments.
Both installed around the same time (initial version 8.4 I think > then 8.5), now 8.6.2
Both have the same languages set up:
- Dutch (default)
- English
But both have different text format settings. The breaking site had a “custom” text format above the default basic_html. I don’t know if that caused the issue.
What also could be different is the language choice on initial setup. Both have the same languages setup, but I think I installed one site initially in English and added Dutch later … and the opposite approach on the other site; Dutch on initial install (making English available by default).
Ps: another observation is that the views field labels and title on the watchdog views are not always translated in all my bilingual sites, but all the rest is. However the website with the untranslated stuff did not have the breaking issue.
Comment #43
matthieuscarset CreditAttribution: matthieuscarset as a volunteer and commentedJust like to pinpoint that this issue is present on Drupal 8.6.2 when user access DBlog admin page
/admin/reports/dblog
Consequence : the "Clear log" button is not displayed anymore.
Therefore, it seems quite critical to me. Users can not clear dblog logs.
Comment #44
indigoxela CreditAttribution: indigoxela commented@yazzybe many thanks for your investigation
I suppose, this is because for the site with default language "en" the update dblog_update_8600 worked as expected, so the text format was changed.
As stated before, dblog_update_8600 didn't work for sites with default languages other than "en".
Comment #45
mpp CreditAttribution: mpp at District09 for District09 commentedNote that once I add a "No results text" under "No Results Behavior" in the "Watchdog" view I can no longer save it.
The weird thing is that I can save it in a clone of the watchdog view:
diff views.view.watchdog.yml views.view.duplicaat_van_watchdog.yml
Comment #46
mpp CreditAttribution: mpp at District09 for District09 commentedComment #47
catchThis should be major per the issue priority guidelines, since it appears on the dblog page itself:
https://www.drupal.org/core/issue-priority
Are there steps to reproduce this with a new Drupal 8.6 install, or does it only happen with upgraded sites where English is not the default language?
I've tried to update the issue title but this could also use an issue summary update.
Comment #48
mpp CreditAttribution: mpp at District09 for District09 commentedHi @catch,
This only happens on upgraded sites.
Comment #49
catchOK trying another re-title.
Comment #50
fgmSame problem here, upgraded 8.6.x, single-language (FR, not EN) site.
Also, AFAIC no one mentioned it, but the issue ins preQuery() happens because
$this->options['content']
is a plain PHP string in that case, while it is expected to be an array, which is visible when comparing the config entity to a snapshot:One of the versions of
display.default.display_options.empty.area.content
is an array withvalue
andformat
keys, while the other is a stringComment #52
Alex MalkovI have D8.6.14 (RU lang) version where the same problem appeared. Thanks #29!
Comment #53
kriboogh CreditAttribution: kriboogh at Calibrate commentedThe problem is in a multilingual or non-en site, the config key 'content' does not contain 'No log messages available' when it checks to see if the view was altered or not.
This fails:
So the update hook doesn't alter the config and thus becomes incorrect.
The views.view.watchdog.yml file states:
However, what is in config is this:
So either for this to work you need to change the config into:
OR
Also not that when you change this, 'No log messages available.' will need to be translated into your language.
Comment #54
aiphesI get this issue too on French website, drupal 8.6.
Thought was a viewreference issue so I posted: https://www.drupal.org/project/viewsreference/issues/3049137
#29 allow to re-save the watchdog view but not to fix my issue on the illegal choice...
Comment #55
TuWebO CreditAttribution: TuWebO at Metadrop commentedHello,
I've run into this issue, I've added a comment on https://www.drupal.org/project/drupal/issues/2916898#comment-13236983.
For me changing docroot/core/modules/dblog/config/optional/views.view.watchdog.yml from:
TO
fixed the issue.
Next step maybe get it patched if you confirm this solves the issue?
Comment #56
TuWebO CreditAttribution: TuWebO at Metadrop commentedAdding summary update. Needs some review since this is what I think it happened, but not sure 100%.
Comment #57
TuWebO CreditAttribution: TuWebO at Metadrop commentedComment #58
TuWebO CreditAttribution: TuWebO at Metadrop commentedFixing wrong link in the issue summary.
Comment #59
TuWebO CreditAttribution: TuWebO at Metadrop commentedComment #60
TuWebO CreditAttribution: TuWebO at Metadrop commentedComment #61
JFeltkamp#29 solved it.
Thank you!!
Comment #62
tunicWhile #29 can be a workaround, is not a fix for this problem. We should fix the root cause so nobody needs to apply that workaround.
Comment #63
TuWebO CreditAttribution: TuWebO at Metadrop commentedHello,
Adding a test-only patch with the functionality that I think should validate.
Still pending a complete patch.
Any review will be very welcome.
Comment #64
TuWebO CreditAttribution: TuWebO at Metadrop commentedComment #66
TuWebO CreditAttribution: TuWebO at Metadrop commentedHello,
Adding the first patch which includes tests and update hook.
It should:
Comment #68
TuWebO CreditAttribution: TuWebO at Metadrop commentedHello,
I need some help here, DbLogViewsTest is failing with the new changes, but I don't know how to run this test after the update, otherwise it won't pass.
If I make, instead, an update test out of it, what should I do with the "old" DbLogViewsTest which won't validates then?
Comment #69
TuWebO CreditAttribution: TuWebO at Metadrop commentedHello,
New patch, in this one we also update "/core/modules/dblog/config/optional/views.view.watchdog" view to have proper config. It might make DbLogViewsTest validates.
Comment #70
TuWebO CreditAttribution: TuWebO at Metadrop commentedChanging title and summary to add the root cause of the errors, which is the missconfigured views.view.watchdog config entity after dblog_update_6000 (if watchdog view has not been customized).
Depending on your site configuration this could lead to:
- PHP warnings on admin/reports/dblog.
- Config import not working properly.
- Errors when saving views.view.watchdog config entity, which might happen in sites installed with a non english language when locale hooks into hook_modules_installed or hook_themes_istalled.
- Some other errors not exposed here and difficult to trace because of dependencies, customizations or overrides in configuration.
Comment #71
TuWebO CreditAttribution: TuWebO at Metadrop commentedTypo dblog_update_6000 should be dblog_update_8600
Comment #72
arsn CreditAttribution: arsn commentedHello. The patch seems to have moved the problem one line further:
Applied on a drupal core 8.7.5. (paths in the log have been searched & replaced.) Database has been succesfully updated & caches rebuild.
I don't feel legitimate to change status to Needs work. Thanks for investigating.
Comment #74
netronicus CreditAttribution: netronicus commentedthis solved the issue :D
https://www.drupal.org/project/drupal/issues/3026229#comment-13272349
Comment #75
aiphes@netronicus
Editor still not display in my case on D8.7.8 after disabling/enabling the dblog module. :(
Comment #76
catchBumping priority.
Comment #77
StefanieV CreditAttribution: StefanieV commentedPatch #69 worked for me. Thanks!
Comment #78
catchThis is a config rather than schema change, so it can be done in a hook_post_update_N().
Also is there a reason it needs to act on the raw config rather than the views configuration entity?
Drupal 9 is going to remove updates up until 88** soon. I think it would be good for this test to run against one of the more up-to-date database dumps, updated to 8.8.0-alpha1, then re-dumped - then we know that database has the incorrect views config introduced in dblog_update_8600().
Another way to approach this would be a fresh database dump but with the incorrect configuration.
Comment #79
catchComment #80
catchComment #81
DamienMcKennaTagging as a requirement for Drupal 9.0-beta1.
Comment #82
DamienMcKennaWorking on this one.
Comment #83
DamienMcKennaThis moves the update into hook_post_update_NAME(), adds return messages to explain what happened and updates the @see line in DblogNoLogsAvailableUpgradeTest.php.
Still to do, per #78:
Comment #84
DamienMcKennaI left in a 'use' statement while I was considering rewriting the update script, the only change in this patch over #83 is that it removes that one line.
Comment #85
DamienMcKennaAnother minuscule change just to change quotes on a few return statements, so I'm not re-running the tests.
Comment #86
DamienMcKennaStill working on this.
Comment #87
DamienMcKennaThe weird thing is that the drupal-8.8.0.bare.standard.php.gz fixture file includes the broken view already - the "empty" key in the display options has a single entry named "area" and not "area_text_custom".
So let's change the test to use the 8.8.0 bare standard file and add some more assertions on the view definition before & after the updates are run.
Comment #88
DamienMcKennaLeaving it back for someone to review.
Comment #91
catchHuh so the exported config is broken too?
Nit: could use parentheses.
Missing the end of this sentence.
Could we add deleting all the dblog entries and visiting admin/reports/dblog? Then the test only patch would show the PHP error.
Comment #92
DamienMcKennaYes, and the fixture is too, so should we include fixing that here too?
Missed this, will add it next time.
*whistles innocently*
This updated patch fixes the comments, but I'm not going to run the tests or change the status as that's the only change.
In theory the test-only patch would fail as-is, but that'd be another scenario to consider. Do we need to test both?
Comment #93
catchThe fixture being broken is OK I think - that represents real 8.x data that we're upgrading to be fixed here. If we do a later dump (say a 9.0.0 dump), then it'll be with this update having been run and correct again.
#4 the test changes that the structure of the view has changed, but it looks similar to the original test coverage in that if our expectations were still wrong it could still pass I think? Whereas visiting the dblog page itself the view either loads or it doesn't.
Comment #94
DamienMcKennaWorking on this.
Comment #95
DamienMcKennaSo, something like this?
Comment #97
DamienMcKennaWhoops sorry about the typo.
I also moved the new test method to the DbLogViewsTest file, it seemed like the better option?
Comment #98
catchCould you upload a test-only patch too?
Comment #100
DamienMcKennaTests-only.
Comment #101
DamienMcKennaWorking on fixing the tests.
Comment #102
DamienMcKennaThis fixes the tests locally. I also discovered that the class in DblogNoLogsAvailableUpgradeTest.php was named incorrectly.
Comment #104
catchThis test seems to be passing with the test-only patch, but it ought to be failing?
Also general note we decided at least for now that while critical, this bug shouldn't block the 9.0.x beta - because we're able to repair the data broken in the update (unlike other upgrade path bugs that leave the database unrecoverable). #3110367: [META] Beta blocking upgrade path bugs. So untagging but of course it'd be great to get this fixed asap regardless.
Comment #105
DamienMcKennaOk, the weird thing is that if I add another text area plugin to the no results behavior portion the new plugin is given the machine name "area_1", indicating that the default name in 8.9.x for a text area plugin is "area", not "area_text_custom". Which suggests that this might be entirely wrong, and possibly superfluous.
Comment #106
DamienMcKennaIf I add a "Text area" plugin to the no results section its machine name is "area", if I add an "Unfiltered text" plugin its machine name is "area_text_custom". So the problem might be made more confusing because of a bug/feature elsewhere in the Views system that loads Drupal\views\Plugin\views\area\Text for the area plugin named "area", even though that plugin's ID should be "text". Maybe?
Comment #107
BramDriesenI tested the patch and this resolved the issue for me. Not sure about the few latest comments though so might needs to go back to needs work.
Comment #108
dagmar@DamienMcKenna Thanks for working on this again!
In #2916898: Do not use basic_html text format for 'No log messages available.' message we changed from
Text
toText Custom
because the minimal profile doesn't creates theFiltered HTML
text format. So I thinkarea_text_custom
is ok.I've been following this problem since a long time, in the past week I tried to replicate it installing 8.5.15 and running the upgrade installing the site in Spanish without success. The only result I managed to get was a non translated string.
But reading again the entire thread I managed to get a clean replicate path:
I'm afraid none of the tests try this scenario, and this is why https://www.drupal.org/project/drupal/issues/2998103#comment-13455097 passes.
Then the rest is testing:
Fixes the problem, so at least we can be sure that user testing was done.
But interestingly there is another way to replicate this:
This is the trace-back:
My guess is because the configuration provided by the yaml in
content:
is a string but the basic filter html is provides an array, the LocaleConfigSubscriber confuses everything.So it seems there is another bug around the locale module that may not be related to views or dblog after all. I'm pretty sure this can affect any configuration that changes from a string of the form
content:
to something like:Comment #109
DamienMcKennaI did the following...
Is there a step I missed in order to trigger the problem?
Comment #110
DamienMcKennaComment #111
dagmar@DamienMcKenna you need to save the watchdog view to trigger the translation process.
Comment #112
DamienMcKennaI just did that, but it didn't trigger the error?
Comment #113
dagmar@DamienMcKenna ah, sorry, you need to install the site in a different language than English. When installing the site choose some other language.
Comment #114
DamienMcKenna@dagmar: Doesn't that just change what the default language is? Or is there more to it than that?
Comment #115
dagmar@DamienMcKenna I'm not 100% sure about the internals of the two options. I know that installing the site in another language also install a few extra translation modules out of the box.
l just tried your approach and indeed the bug cannot be reproduced if you install the site in English. It seems the trick is to install the site in a different language than English. It doesn't even need to be multilingual.
Comment #116
xjmComment #117
tedbowComment #118
tedbowI trying to reproduce the problem but I can't
I am following the instructions that @dagmar wrote in #108
See his instructions directly after
PHP Version 7.2.23
. I thought about switching to 5.6 but I assume @dagmar would have mentioned that since commented just a month ago and php 5.6 is already deprecated.The only way I can get a fatal error is to try to save the view without running database updates.
We need an issue summary update with instructions to reproduce this problem. If it is the instructions from #108 will still need the issue summary update and try to get someone else to reproduce the problem on test site not a real so we can narrow down what the problem is.
Comment #119
tedbowUpdate to #118
I am now able to now reproduce the error installing drupal in another language.
Here are my steps similar to @dagmar's steps in #108
The last step will get the error
I step debugged this and interestingly I think in this case it becausedblog_update_8600()
did not update the view. Becausedblog_update_8600
hasThe 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.So there might another problem going on here
Comment #120
tedbowfollow up to #119.
I am now able to reproduce the error saving the Watchdog view with an English install. It involves switching the language and updating the view after install.
Rather than listed the steps I am attaching the script I am using to reproduce. It is mostly an automated script but has points that needs user action.
I am working on writing update test for this but have not succeed yet.
If I use this script but instead of
git checkout 8.9.x
to run the updates I switch branch patched with the file in #102 it does not get the error. So at least for manual testing this proves it fixes the problem, though it would be great if others could confirm.
I am not assigning this to myself because I don't want to stop anyone else from working on tests for this.
Comment #121
tedbowThis 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
admin/reports/dblog
and encountered an erroradmin/reports/dblog
and encountered an errorthe issue summary for this describes 1). 2) is probably related but is different view but I guessing affects less people because it would only affect users that were actually editing the view.
So split off 2) into #3125425: Error saving watchdog view after dblog_update_8600()
I think we should handle 1) in this issue.
Comment #122
tim.plunkettWhen the "Recent Log Messages" page was converted to a view, it used the "Text area" handler.
id: area
As seen in views.views.inc (currently lines 59-65), that handler definition corresponds to
\Drupal\views\Plugin\views\area\Text
That plugin expects there to be a
content
array containing thevalue
key.See https://github.com/drupal/drupal/blob/8.8.x/core/modules/views/src/Plugi...
That is also what shipped in 8.5: https://github.com/drupal/drupal/blob/8.5.x/core/modules/dblog/config/op...
After #2916898: Do not use basic_html text format for 'No log messages available.' message, this view was changed to no longer use the Basic HTML format, and by doing so, switched the handler to "Unfiltered text".
id: area_text_custom
As seen in views.views.inc (currently lines 67-73), that handler definition corresponds to
\Drupal\views\Plugin\views\area\TextCustom
That plugin expects there to be a
content
string.See https://github.com/drupal/drupal/blob/8.8.x/core/modules/views/src/Plugi...
And this is what shipped afterward: https://github.com/drupal/drupal/blob/8.8.x/core/modules/dblog/config/op...
The config presented in #15 (and confirmed by others) could never have existed without some developer interaction.
dblog_update_8600()
correctly performed the updates. And here's the key point: even if that update never ran, nothing would be broken.The only way for things to be broken is if the
content
key were changed and theid/plugin_id
didn't, or vice versa.In either the old or new set of config, nothing would be broken.
My theory is that the broken config resulted from an incorrectly resolved merge conflict when exporting config.
The reproducible bug that @tedbow describes in #121 is unrelated to the bug as originally described, so +1 to splitting that off.
Based on all of the above, I am downgrading this to a normal bug.
Comment #123
tim.plunkettOh, one other thought. The fact that key is still
area
even though the handler ID isarea_text_custom
is not a problem. Those key names are not used literally. If you add multiple "Text area" plugins you will get keys likearea
,area_1
,area_2
etc.Comment #128
floown CreditAttribution: floown commentedHello,
On a D8 migrated to D9 latest I have the same bug.
Sorry for my beginner question, but by uninstalling Database logging, wouldn't it also remove the faulty view, and when reactivating the module, the view would be rebuilt with the right criteria, or am I wrong?
Regards
Comment #129
WiseMike CreditAttribution: WiseMike commentedOn a D9 latest I have the same bug.
UP. Fix by edit views
Comment #130
larowlanIs this still an issue? Those 8.6 updates are long removed now
Comment #131
catchIt's still an issue, the update can corrupt the view if English isn't the default language, resaving the view repairs it.
There are two groups of sites potentially affected:
1. Sites where English isn't the default language that have already updated from Drupal < 8.6, but then have never resaved the view. There is no way to know how many of those sites exist.
2. Sites where English isn't the default language that are still on Drupal < 8.6 (less than 10-15,000 sites with any language configuration) that haven't run the update yet, and will need to update to Drupal 8.9, then from there to Drupal 9.
If we wanted to fix it for either group, the only way now would be to add a new update to Drupal 9 that repairs the view from the broken state that can be introduced in dblog_update_8600() but leaves it untouched for sites where it's correct.
It's definitely true that it's a 'normal' bug compared to almost any other upgrade path bug, only affects the one page, fixable by resaving the view. It's also the case that the number of sites affected is small and diminishing. All these are why it hasn't been fixed yet, but to close the issue I think we'd need to either fix it, or explicitly decide that we're never going to.
Comment #132
quietone CreditAttribution: quietone at PreviousNext commentedIS update.
Comment #133
quietone CreditAttribution: quietone at PreviousNext commented#121 states two cases, and that this issue is for case 1 and the other issue is for case 2. But the Issue Summary here is for case 2 as are many of the comments. Case 2 (the Placeholder error) is in #3125425: Error saving watchdog view after dblog_update_8600(). This issue concerns the "Warning: Illegal string offset 'value' in Drupal\views\…".
Using #122 I found a way to reproduce this error and then did some testing.
Maybe we should be treating these two issues the same and work with the patch from #103?
Comment #134
quietone CreditAttribution: quietone at PreviousNext commentedMore testing and I have discovered that there is still a problem with the 'text area' plugin in the 'No Results behavior' section on Drupal 9.4.x, Italian standard install. If the plugin is deleted and then re-added a Notice is logged. A bit of improvement from an Error or a Warning ;-)
Messaggio Notice: Array to string conversion in Drupal\Core\Database\StatementWrapper->execute() (line 145 of /var/www/html/core/lib/Drupal/Core/Database/StatementWrapper.php)
I have given it some thought and I am going to close #3125425: Error saving watchdog view after dblog_update_8600() as a duplicate. I found that I could fix the Case 2 error but then I would get the error in Case 1 (this issue). But more importantly the fix is the same.
Added a workaround to the IS.
Comment #135
quietone CreditAttribution: quietone at PreviousNext commentedComment #136
quietone CreditAttribution: quietone at PreviousNext commentedAdded a change record that includes the steps to repair this problem.
Comment #138
quietone CreditAttribution: quietone at PreviousNext commentedDiscussed with xjm and catch in Slack. It was pointed out that the update, dblog_update_8600(), is no longer in a supported version of Drupal. And if a site can't update because of this problem there are steps that can be done from the UI to repair it. The steps are in this issue summary and the change record. Therefor since there is a path forward and no one is actually prevented from updating this can be closed.
Thanks!
Comment #139
drupalfan2 CreditAttribution: drupalfan2 as a volunteer commented#29 worked for me. Thx.
Comment #140
Flodevelop CreditAttribution: Flodevelop commentedWhy not overwrite the views.view.watchdog.yml with the default one from D10 by example and import it :
https://api.drupal.org/api/drupal/core%21modules%21dblog%21config%21opti...
Comment #141
vinyl_roadsIndeed, #140 is a very simple solution.
Comment #142
urix CreditAttribution: urix commentedThank you for the solution!