Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
There were a lot of database updated when upgrading to 8.4.
All the other updates ran fine, just this one won't run.
azer@wxcv:~/azer/qsdf/staging/webroot$ drush updb
The following updates are pending:
views module :
Fix table names for revision metadata fields.
Do you wish to run all pending updates? (y/n): y
Error: Call to a member function getConfigDependencyKey() on null in /var/www/openupmedia/qsdf/staging/webroot/core/modules/user/src/Plugin/views/filter/Roles.php on line 82 #0 /var/www/openupmedia/qsdf/staging/webroot/core/lib/Drupal/Core/Plugin/PluginDependencyTrait.php(47): Drupal\user\Plugin\views\filter\Roles->calculateDependencies()
#1 [internal function]: Drupal\views\Plugin\views\display\DisplayPluginBase->calculatePluginDependencies(Object(Drupal\user\Plugin\views\filter\Roles), 8)
#2 /var/www/openupmedia/qsdf/staging/webroot/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php(961): array_walk(Array, Array)
#3 /var/www/openupmedia/qsdf/staging/webroot/core/lib/Drupal/Core/Plugin/PluginDependencyTrait.php(47): Drupal\views\Plugin\views\display\DisplayPluginBase->calculateDependencies()
#4 /var/www/openupmedia/qsdf/staging/webroot/core/modules/views/src/Entity/View.php(281): Drupal\Core\Config\Entity\ConfigEntityBase->calculatePluginDependencies(Object(Drupal\views\Plugin\views\display\DefaultDisplay))
#5 /var/www/openupmedia/qsdf/staging/webroot/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(346): Drupal\views\Entity\View->calculateDependencies()
#6 /var/www/openupmedia/qsdf/staging/webroot/core/modules/views/src/Entity/View.php(291): Drupal\Core\Config\Entity\ConfigEntityBase->preSave(Object(Drupal\Core\Config\Entity\ConfigEntityStorage))
#7 /var/www/openupmedia/qsdf/staging/webroot/core/lib/Drupal/Core/Entity/EntityStorageBase.php(434): Drupal\views\Entity\View->preSave(Object(Drupal\Core\Config\Entity\ConfigEntityStorage))
#8 /var/www/openupmedia/qsdf/staging/webroot/core/lib/Drupal/Core/Entity/EntityStorageBase.php(389): Drupal\Core\Entity\EntityStorageBase->doPreSave(Object(Drupal\views\Entity\View))
#9 /var/www/openupmedia/qsdf/staging/webroot/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(259): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\views\Entity\View))
#10 /var/www/openupmedia/qsdf/staging/webroot/core/lib/Drupal/Core/Entity/Entity.php(377): Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object(Drupal\views\Entity\View))
#11 /var/www/openupmedia/qsdf/staging/webroot/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(637): Drupal\Core\Entity\Entity->save()
#12 /var/www/openupmedia/qsdf/staging/webroot/core/modules/views/views.post_update.php(213): Drupal\Core\Config\Entity\ConfigEntityBase->save()
#13 [internal function]: {closure}(Object(Drupal\views\Entity\View), 'crm_manager_use...')
#14 /var/www/openupmedia/qsdf/staging/webroot/core/modules/views/views.post_update.php(214): array_walk(Array, Object(Closure))
#15 /var/www/openupmedia/qsdf/staging/webroot/core/includes/update.inc(241): views_post_update_revision_metadata_fields(Array)
#16 phar:///usr/local/bin/drush/commands/core/drupal/batch.inc(163): update_invoke_post_update('views_post_upda...', Object(DrushBatchContext))
#17 phar:///usr/local/bin/drush/commands/core/drupal/batch.inc(111): _drush_batch_worker()
#18 phar:///usr/local/bin/drush/includes/batch.inc(98): _drush_batch_command('1005')
#19 phar:///usr/local/bin/drush/commands/core/drupal/update.inc(193): drush_batch_command('1005')
#20 phar:///usr/local/bin/drush/commands/core/core.drush.inc(1227): _update_batch_command('1005')
#21 phar:///usr/local/bin/drush/includes/command.inc(422): drush_core_updatedb_batch_process('1005')
#22 phar:///usr/local/bin/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
#23 phar:///usr/local/bin/drush/includes/command.inc(199): drush_command('1005')
#24 phar:///usr/local/bin/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#25 phar:///usr/local/bin/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#26 phar:///usr/local/bin/drush/includes/startup.inc(458): drush_main()
#27 phar:///usr/local/bin/drush/includes/startup.inc(365): drush_run_main(false, '/', 'Phar detected. ...')
#28 phar:///usr/local/bin/drush/drush(114): drush_startup(Array)
#29 /usr/local/bin/drush(10): require('phar:///usr/loc...')
#30 {main}
Comment | File | Size | Author |
---|---|---|---|
#57 | interdiff-pre-8.8.txt | 926 bytes | tedbow |
#57 | 2917006-57-pre-8.8.patch | 2.46 KB | tedbow |
#57 | 2917006-57.patch | 2.49 KB | tedbow |
#57 | interdiff-55-57.txt | 735 bytes | tedbow |
#55 | interdiff-51-55.txt | 1.65 KB | tedbow |
Comments
Comment #2
cilefen CreditAttribution: cilefen as a volunteer commentedComment #3
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedThis patch should help with that error, but the actual problem in your case is that you have view with an (somewhat broken) outdated configuration, meaning that one of its filters is set to use a role that doesn't exist anymore.
Comment #5
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedHere's a patch that applies to 8.4.x, the one above was for 8.5.x.
Comment #6
Pascal- CreditAttribution: Pascal- commentedpatch in #5 solved it, thx!
just noticed my views overview was no longer working, but it's working again after applying the patch
Comment #7
jnimchuk CreditAttribution: jnimchuk commentedI have the same/similar issue. But I updated with Update.php not Drush.
Please see: https://www.drupal.org/node/2916612
Comment #8
amateescu CreditAttribution: amateescu for Pfizer, Inc. commented@jnimchuk, does the patch from #5 work for you as well?
Comment #9
jnimchuk CreditAttribution: jnimchuk commentedSorry, but the patch doesn't work for me. Here's the message from my log:
Notice: Undefined offset: 1 in Drupal\system\Controller\DbUpdateController->results() (line 413 of /var/www/vhosts/thejdngroup.com/domains/test8.portrevolt.com/core/modules/system/src/Controller/DbUpdateController.php) #0 /var/www/vhosts/thejdngroup.com/domains/test8.portrevolt.com/core/includes/bootstrap.inc(566): _drupal_error_handler_real(8, 'Undefined offse...', '/var/www/vhosts...', 413, Array) #1 /var/www/vhosts/thejdngroup.com/domains/test8.portrevolt.com/core/modules/system/src/Controller/DbUpdateController.php(413): _drupal_error_handler(8, 'Undefined offse...', '/var/www/vhosts...', 413, Array) #2 /var/www/vhosts/thejdngroup.com/domains/test8.portrevolt.com/core/modules/system/src/Controller/DbUpdateController.php(179): Drupal\system\Controller\DbUpdateController->results(Object(Symfony\Component\HttpFoundation\Request)) #3 [internal function]: Drupal\system\Controller\DbUpdateController->handle('results', Object(Symfony\Component\HttpFoundation\Request)) #4 /var/www/vhosts/thejdngroup.com/domains/test8.portrevolt.com/core/lib/Drupal/Core/Update/UpdateKernel.php(110): call_user_func_array(Array, Array) #5 /var/www/vhosts/thejdngroup.com/domains/test8.portrevolt.com/core/lib/Drupal/Core/Update/UpdateKernel.php(73): Drupal\Core\Update\UpdateKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request)) #6 /var/www/vhosts/thejdngroup.com/domains/test8.portrevolt.com/update.php(28): Drupal\Core\Update\UpdateKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #7 {main}.
Comment #10
Pascal- CreditAttribution: Pascal- commentedpatch in #5 fails on my staging and live database, although it worked on my local environment
tried manually saving all my views, which was successful, but doesn't solve the drush updb error
everything does seem to be working, except that I keep getting the error in the first post when doing an updb
Comment #11
kruser CreditAttribution: kruser as a volunteer commentedThe patch in #5 didn't have an effect on the error for me either. Looks like I have the same error as #9
Comment #12
jnimchuk CreditAttribution: jnimchuk commentedAny update on this issue?
Comment #13
Anonymous (not verified) CreditAttribution: Anonymous commentedHi there,
I had this error as well, the issue was a view with a "Missing / broken handler" on some filter.
I found out by updating the function "views_post_update_revision_metadata_fields" in the core views module (File views.post_update.php) to print the current view details when it breaks. (Don't forget to revert your changes if you try).
Hope it will helps,
Cheers
Comment #14
maxilein CreditAttribution: maxilein commentedHi,
what do I do about a Missing / broken handler?
How d I fix that?
Comment #15
tajinder.minhas CreditAttribution: tajinder.minhas as a volunteer and at SDG Corporation commentedHi maxilein,
Can you please describe the view on which you are facing such issue. I am not able to replicate this issue on my local, which doing the update.
Comment #16
jnimchuk CreditAttribution: jnimchuk commentedFor me the view is failing to update for:
views_post_update_revision_metadata_fields.module
See my previous post #9.
Comment #17
maxilein CreditAttribution: maxilein commented1 pending update
views module
Fix table names for revision metadata fields.
An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /update.php/start?id=233&op=do_nojs&op=do
StatusText: Internal Server Error
ResponseText:
The update process was aborted prematurely while running update # in views_post_update_revision_metadata_fields.module. All errors have been logged. You may need to check the watchdog database table manually.
Notice: Undefined offset: 1 in Drupal\system\Controller\DbUpdateController->results() (line 413 of //../web/content/core/modules/system/src/Controller/DbUpdateController.php)
#0 //../web/content/core/includes/bootstrap.inc(566): _drupal_error_handler_real(8, 'Undefined offse...', '/...', 413, Array)
#1 //../web/content/core/modules/system/src/Controller/DbUpdateController.php(413): _drupal_error_handler(8, 'Undefined offse...', '/...', 413, Array)
#2 //../web/content/core/modules/system/src/Controller/DbUpdateController.php(179): Drupal\system\Controller\DbUpdateController->results(Object(Symfony\Component\HttpFoundation\Request))
#3 [internal function]: Drupal\system\Controller\DbUpdateController->handle('results', Object(Symfony\Component\HttpFoundation\Request))
#4 //../web/content/core/lib/Drupal/Core/Update/UpdateKernel.php(110): call_user_func_array(Array, Array)
#5 //../web/content/core/lib/Drupal/Core/Update/UpdateKernel.php(73): Drupal\Core\Update\UpdateKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request))
#6 //../web/content/update.php(28): Drupal\Core\Update\UpdateKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#7 {main}.
Comment #18
chris5156I am having exactly this issue updating database tables after upgrading to 8.4.2. Providing my logs here in case they help. Have attempted the fix in #9 but got no extra info from it.
update.php tells me:
On running the updates, it says it has completed "1 of 2" (having said only 1 pending), then fails:
The error page says:
The update process was aborted prematurely while running update # in views_post_update_revision_metadata_fields.module. All errors have been logged. You may need to check the watchdog database table manually.
And finally the log entry says:
Notice: Undefined offset: 1 in Drupal\system\Controller\DbUpdateController->results() (line 413 of /filepath/public_html/core/modules/system/src/Controller/DbUpdateController.php) #0 /filepath/public_html/core/includes/bootstrap.inc(566): _drupal_error_handler_real(8, 'Undefined offse...', '/filepath...', 413, Array) #1 /filepath/public_html/core/modules/system/src/Controller/DbUpdateController.php(413): _drupal_error_handler(8, 'Undefined offse...', '/filepath...', 413, Array) #2 /filepath/public_html/core/modules/system/src/Controller/DbUpdateController.php(179): Drupal\system\Controller\DbUpdateController->results(Object(Symfony\Component\HttpFoundation\Request)) #3 [internal function]: Drupal\system\Controller\DbUpdateController->handle('results', Object(Symfony\Component\HttpFoundation\Request)) #4 /filepath/public_html/core/lib/Drupal/Core/Update/UpdateKernel.php(110): call_user_func_array(Array, Array) #5 /filepath/public_html/core/lib/Drupal/Core/Update/UpdateKernel.php(73): Drupal\Core\Update\UpdateKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request)) #6 /filepath/public_html/update.php(28): Drupal\Core\Update\UpdateKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #7 {main}.
Comment #19
Pascal- CreditAttribution: Pascal- commentedComment #20
Rick Hood CreditAttribution: Rick Hood commentedSimilar problem for me:
I tracked down the view where the problem is, group member search: /group/1/member-search which has this error after the 8.4.0 upgrade, but not with 8.3.7:
Comment #21
maxilein CreditAttribution: maxilein commentedI think the problem exists when a module does not uninstall correctly and leaves somethings in a table ...
Comment #22
nikita_ttTry to remove and add (manually) again the filters in View which give an error.
Comment #23
jnimchuk CreditAttribution: jnimchuk commentedI used Drupal 6 for five years before upgrading to version 8. Not once was there an update to core that caused a problem for this long.
This issue was introduced in 8.4; previously no problem.
Will somebody please address this so that we don't have this problem that has lasted months?
Thank you,
John
Comment #24
kruser CreditAttribution: kruser as a volunteer commentedIf it's an "HTTP Result Code: 500" error, it's usually a memory issue. Try increasing your PHP memory to 256MB or higher, and run update again. That got it working for me.
Comment #25
tepelena CreditAttribution: tepelena commentedJust updated from 8.3.7 to 8.4.4 and I am having the same problem as well.
How can I figure out which view is causing the problem?
Based on this thread and google searches this seems to be a serious problem affecting a lot of users.
Comment #26
cilefen CreditAttribution: cilefen as a volunteer commented@tpelena The error you posted on this update looks different than any other posted on this thread. Is anything logged?
Comment #27
cilefen CreditAttribution: cilefen as a volunteer commentedI now see you opened another issue.
Comment #28
jnimchuk CreditAttribution: jnimchuk commentedPer #24 — increasing the PHP memory to 256M worked for me too.
Thanks Kruser!
Comment #29
gr8tkicks CreditAttribution: gr8tkicks as a volunteer and at University of California commentedI have tried the latest patch with no success (https://www.drupal.org/files/issues/2917006-8.4.x.patch) anyone else have an alternative that works?
Comment #31
Pascal- CreditAttribution: Pascal- commentedSame patch as in #5 but for 8.5.x
Also works for 8.4.4
Solved the issue for me.
#5 patch probably works for older 8.4 versions
Comment #32
Pascal- CreditAttribution: Pascal- commentedComment #33
catchBumping this to critical for visiblity. The update itself isn't the problem, but it's combining with corrupted views to produce the fatal error.
A possible option other than hiding the error would be to try to detect the problem with views in the update itself and correct them before updating.
Comment #34
catchComment #35
Pascal- CreditAttribution: Pascal- commentedCould someone explain me why my patch is failing the tests?
It's a plain copy/paste from git diff against the latest 8.5.x core
The error is :fatal: corrupt patch at line 7
Which is an empty line
Comment #36
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedRe-uploading the patch from #3 which still applies just fine to 8.6.x and 8.5.x.
Comment #37
Pascal- CreditAttribution: Pascal- commentedEdit: Just noticed my patch starts? from a different head a6986f2257 instead of a6986f2
Did I start from a wrong project?
Would really help me in future contributions to get this sorted ...
@amateescu #3 is indeed exactly the same as my patch in #31 (didn't notice before)
How is my patch failing and #3 patch passing the tests then?
Comment #38
alexpott@Pascal- it looks like line endings are an issue. The patch in #31 has windows line endings. Have a look at https://www.drupal.org/documentation/git/configure for how to configure git so that the correct line endings are used.
Comment #39
catchDiscussed briefly with @alexpott.
Let's add an else with a trigger_error() to inform people there's a problem.
I also think we should open a follow-up to potentially remove the roles from the Views when they're missing from the site (or at least to take a firm decision not to do that if we don't want to).
Comment #40
chris5156I'm still getting the same issue I described in #18. I'm now running 8.4.5, and have tried the patch but it makes no difference - database updates still fail and I still get the same error.
Comment #42
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedAdded a
trigger_error()
as requested above :)Comment #43
BerdirThat makes sense. Not sure about tests, seems a bit overkill to have a test view/update test for that.
Reminds me of #2925890: Invalid config structures can result in exceptions when saving a config entity, I still have that applied in some projects.
Comment #44
alexpottI definitely think we should have test coverage of this behaviour. I'm not sure it needs to be an update test though. I think we need something to assert that the warning is triggered.
Comment #45
catchComment #46
sam-elayyoub CreditAttribution: sam-elayyoub as a volunteer and at Achieve Internet commentedIf it's null then the issue showed up, it's the load() for null is the problem, or the $role_id doesn't have info to load. however, try this patch, another thing if the $role_id is 0, this would give you an array null error, which in this case the error would keep triggering all the way, for every view, so no need to trigger errors for this one.
let me know if this one work.
Comment #47
neclimdulThere are a lot of style problems with your patch sam. Also, I think we'd want to have the warning though I haven't tried amateescu's patch out. Seems the only complaint was we needed a test.
Comment #48
sam-elayyoub CreditAttribution: sam-elayyoub as a volunteer and at Achieve Internet commented@neclimdul can you please share what you see wrong in styles?
Comment #49
neclimdulSorry that was a bit of a drive by comment. I meant coding standards aka code style. Drupal has pretty strict standards(https://www.drupal.org/docs/develop/standards) and even when fixing it in a patch it is worth being careful because there are generally issues to fix code style already created and it can make review harder because it distracts from the notable changes.
Like changing the { placement. Drupal requires them on the same line.
Also your comment has a space after it and needs a period. Its also a good idea to tell _why_ in your comment instead of stating what the code does. The if and continue already clearly show we're continuing when the role is falsy/empty. But what purpose does that serve? This doubles to help someone reviewing the patch and to the poor soul trying to debug it later.
Comment #50
sam-elayyoub CreditAttribution: sam-elayyoub as a volunteer and at Achieve Internet commentedThank you @neclimdul, here's the new patch with error trigger and cleaned up file with --standard=Drupal,DrupalPractice
Comment #51
tedbowStarting from #42
That patch was RTBC and just needed a test.
I am not sure what #46 was correcting for.
Was the "@" here intentional?
I couldn't find any other case in core where we use
@trigger_error
with aE_USER_WARNING
though we use@trigger_error
withE_USER_DEPRECATED
Removing the "@" and adding a test.
Comment #52
Wim Leers#51 looks great. I wanted to RTBC but went looking for signals that would make me not RTBC. Instead, I found #43 by @Berdir, where he RTBC'd the same set of changes, just without test coverage.
That gives me full confidence to RTBC this :)
Running tests locally show they fail. But rather than expecting a core committer to do the same, I'm just uploading #51 with just the test coverage to prove it fails.
Comment #53
alexpottWe don't use these annotations anymore. We use ->expectException() and ->expectExceptionMessage()
Comment #54
Wim LeersD'oh, yes. Sorry about that.
Comment #55
tedbow@alexpott thanks for taking a look at the issue. Fixing #53.
@Wim Leers thanks for the test only patch
Also
Since we are now using
expectException()
we no longer need the try catch.We can just call
expectException()
after the first call to$view->calculateDependencies()
. Therefore if the first call has an exception the test will fail.Comment #56
alexpottQuibbling - but actually no exception is thrown by runtime code. PHPUnit causes warnings to become exceptions. So they can be tested like this. This should be
Ensure no warning is triggered before the role is deleted.
Comment #57
tedbow$this->expectException()
Comment #59
Wim Leers🚢
Comment #60
alexpottCrediting @kruser, @jnimchuk for testing the issue and providing feedback
Crediting @catch, @alexpott, @neclimdul for reviews
Crediting @romainlepolh for providing that helped track this down
Crediting @chris5156, @Rick Hood for providing a thorough bug reports
Committed and pushed a90dae47a0 to 9.0.x and 962d2db57e to 8.9.x. Thanks!
Asking other committers for a +1 for backport to 8.8.x
Comment #64
alexpottDiscussed with @catch and we agreed to backport this to 8.8.x
Comment #67
quietone CreditAttribution: quietone at PreviousNext commentedClosed #2829825: views_post_update_serializer_dependencies() can cause update.php to fail as a duplicate, adding credit.