I'm getting this error when testing the upgrade path:

Error: Call to undefined method Drupal\Core\Config\Schema\Undefined::get() in Drupal\Core\Config\StorableConfigBase->castValue() (line 179 of [error]

Backtrace:


#0 web/core/lib/Drupal/Core/Config/Config.php(212): Drupal\Core\Config\StorableConfigBase->castValue('bc_primitives_a...', false)
#1 web/core/modules/serialization/serialization.install(45): Drupal\Core\Config\Config->save(false)
#2 vendor/drush/drush/commands/core/drupal/update.inc(60): serialization_update_8302(Array)
#3 vendor/drush/drush/commands/core/drupal/batch.inc(163): drush_update_do_one('serialization', 8302, Array, Object(DrushBatchContext))
#4 vendor/drush/drush/commands/core/drupal/batch.inc(111): _drush_batch_worker()
#5 vendor/drush/drush/includes/batch.inc(98): _drush_batch_command('9')
#6 vendor/drush/drush/commands/core/drupal/update.inc(193): drush_batch_command('9')
#7 vendor/drush/drush/commands/core/core.drush.inc(1227): _update_batch_command('9')
#8 vendor/drush/drush/includes/command.inc(422): drush_core_updatedb_batch_process('9')
#9 vendor/drush/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
#10 vendor/drush/drush/includes/command.inc(199): drush_command('9')
#11 vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#12 vendor/drush/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#13 vendor/drush/drush/drush.php(12): drush_main()

This happens before the schema cache is updated I guess, but what I don't understand is why this update function *explicitly* passes FALSE, clearly the data that we change is trusted?

It works fine then on a second run.

Comments

Berdir created an issue. See original summary.

berdir’s picture

Status: Active » Needs review
StatusFileSize
new790 bytes
wim leers’s picture

Status: Needs review » Needs work
+++ b/core/modules/serialization/serialization.install
@@ -42,7 +42,7 @@ function serialization_update_8302() {
+    ->save(TRUE);1

Syntax error :)

RTBC after that's fixed.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new789 bytes

I managed to get that in there between checking the diff and writing it into a file...

berdir’s picture

@Wim: See IRC discussion, do you know if there is a reason for that FALSE?

wim leers’s picture

Assigned: Unassigned » catch
Status: Needs review » Reviewed & tested by the community
17:32:28 <berdir> what confused me is that it explicitly passes FALSE to save, I'd understand forgetting to pass TRUE, but not sure about this
17:32:44 <berdir> maybe damiankloip or someone else who worked on https://www.drupal.org/node/2751325 knows?
17:32:51 <drupalbot> https://www.drupal.org/node/2751325 => All serialized values are strings, should be integers/booleans when appropriate #2751325: All serialized values are strings, should be integers/booleans when appropriate => 265 comments, 1 IRC mention
17:47:44 <catch> berdir: my assumption would be they meant to pass TRUE and got the argument switched when writing the patch.

I agree with @catch's suspicion at 17:47:44.

But I still did some issue archeology. Turns out that the patch at #2751325-179: All serialized values are strings, should be integers/booleans when appropriate had this right (->save(TRUE)). Then #2751325-182: All serialized values are strings, should be integers/booleans when appropriate removed that hunk completely. (Both of those patches by @tedbow.) Then @alexpott restored this hunk in #2751325-188: All serialized values are strings, should be integers/booleans when appropriate after discussing it with @catch. But it inverted the value. Why? I suspect because we changed the default value for

#182
+function serialization_update_8302() {
+  $config_factory = \Drupal::configFactory();
+
+  $config_factory->getEditable('serialization.settings')
+    ->set('bc_primitive_data_normalizer', TRUE)
+    ->save(TRUE);
+}
#188
+function serialization_update_8302() {
+  $config_factory = \Drupal::configFactory();
+  $config_factory->getEditable('serialization.settings')
+    ->set('bc_primitives_as_strings', FALSE)
+    ->save(FALSE);
+
+  return t('The REST API will no longer output all values as strings. Integers/booleans will be used where appropriate. <a href="https://www.drupal.org/node/2837696">If your site depends on these value being strings, read the change record to learn how to enable the BC mode.</a>');
+}

i.e. I'm willing to bet that @alexpott simply search-and-replaced TRUE with FALSE and replaced one thing too many.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Nice archaeology.

Committed/pushed to 8.4.x and cherry-picked to 8.3.x. Thanks!

catch’s picture

  • catch committed f408410 on 8.4.x
    Issue #2867113 by Berdir, Wim Leers: Fatal error in...

  • catch committed d91d60e on 8.3.x
    Issue #2867113 by Berdir, Wim Leers: Fatal error in...
MmMnRr’s picture

Hi,

I am trying to update from Drupal 8.1.1 to the latest Drupal 8.3.0 stable version but I am receiving that error message:

PHP Fatal error:  Call to undefined method Drupal\Core\Config\Schema\Undefined::get() in /.../core/lib/Drupal/Core/Config/StorableConfigBase.php on line 179

I have checked the serialization_update_8302() function in serialization.install but it has already ->save(TRUE) call.

I am unable to update to 8.3.0 and I would like not to use the 8.3.x unstable version.
Is there a solution for 8.3.0 or are you going to release a new stable version?

catch’s picture

@MmMnRr are you able to provide a backtrace? It's possible a different update has a similar problem to the one fixed here.

berdir’s picture

And while it would be very helpful to know which update function triggered this for you (we should also have a separate issue to make such a case *not* fail with a fatal error), you should be able to get around it with a drush cr before running the updates. If you can use drush, otherwise you can also clear the cache_discovery table by hand.

wim leers’s picture

It's possible a different update has a similar problem to the one fixed here.

That seems unlikely, I grepped the entire codebase for ->save(FALSE), and the only remaining occurrences are in ConfigEntityStorageTest.

Besides, #11 says they traced it to this ->save(TRUE) call. It seems that #11 is a different error. AFAICT this must be happening in here:

  protected function castValue($key, $value) {
    $element = $this->getSchemaWrapper()->get($key);

It's the only ->get( call in StorableConfigBase.

Without more information/steps to reproduce, I don't think we'll be able to help here.

MmMnRr’s picture

I tried to run update.php again and for no reason it worked perfectly now.
So the issue is solved.

I tried multiple times to run update.php and I always received the same error. But now it worked.

I do not have drush installed in my server yet.
The trace came from the Apache log.
I checked the specific line referenced in the trace and it is the following:

/.../core/lib/Drupal/Core/Config/StorableConfigBase.php

protected function castValue($key, $value) {
    $element = $this->getSchemaWrapper()->get($key);

It is the same code as explained in comment #14.
The error appeared when I try to run update.php. But now it disappeared.

The only difference since the last try is that I have navigated through the website pages, although the update did not work.
Maybe that navigation triggered something. But I have no proof.

Thank you and sorry for the inconvenience.

alexpott’s picture

berdir’s picture

@MmMnRr, it would be very helpful if you could join us over in #2867444: Configuration schema errors whilst updating to 8.3.0 and provide anything that might be useful in figuring out more about this: From which version you upgrade, if you know which updates were remaining on later runs that had the be executed again, what contrib modules you use, ...

alexpott’s picture

@MmMnRr also if you have anymore of the backtrace of #11 it would be really great to see it.

MmMnRr’s picture

@alexpott Unfortunately, as I did not update from drush I do not have more trace information. Furthermore, as the update worked now, I am unable to reproduce the issue again.

Status: Fixed » Closed (fixed)

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

ajay gadhavana’s picture

I have same issue.
BTW first i was working on drupal 8.1 and I updated to 8.3.4
Files updated but when trying to run update.php its giving below errors.

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /update.php/start?id=14&op=do_nojs&op=do
StatusText: OK
ResponseText:
Fatal error: Call to undefined method Drupal\Core\Config\Schema\Undefined::get() in /core/lib/Drupal/Core/Config/StorableConfigBase.php on line 179

ajay gadhavana’s picture

Hello all,

My error also solved.
I also tried to run update.php multiple times but its not helped.
after that I have cleared the caches and run again update.php all the errors got disappeared.
I have list of errors if anyone want to check more.