After updating acquia_lift from 3.7 to 3.9 we get following PHP notice for some page URLs:

Notice: Undefined index: bootstrap_mode in Drupal\acquia_lift\Service\Context\PageContext->setContextAdvanced() (line 216 of modules/contrib/acquia_lift/src/Service/Context/PageContext.php).
Drupal\acquia_lift\Service\Context\PageContext->setContextAdvanced(Array) (Line: 133)
Drupal\acquia_lift\Service\Context\PageContext->__construct(Object, Object, Object, Object, Object) (Line: 278)
Drupal\Component\DependencyInjection\Container->createService(Array, 'acquia_lift.service.context.page_context') (Line: 171)
Drupal\Component\DependencyInjection\Container->get('acquia_lift.service.context.page_context') (Line: 158)
Drupal::service('acquia_lift.service.context.page_context') (Line: 32)
acquia_lift_page_attachments(Array) (Line: 297)
Drupal\Core\Render\MainContent\HtmlRenderer->invokePageAttachmentHooks(Array) (Line: 273)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 117)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 156)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 184)
Drupal\page_cache\StackMiddleware\PageCache->fetch(Object, 1, 1) (Line: 121)
Drupal\page_cache\StackMiddleware\PageCache->lookup(Object, 1, 1) (Line: 75)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 665)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
CommentFileSizeAuthor
#4 acquia-lift-3007352-2.patch741 bytesdaiwik.addweb

Comments

IT-Cru created an issue. See original summary.

malaynayak’s picture

I came across the same issue and fixed it by saving the configuration at admin/config/services/acquia-lift. Hope this works for you.

malaynayak’s picture

Status: Active » Needs review
daiwik.addweb’s picture

StatusFileSize
new741 bytes

@IT-Cru, Please find my attached patch, I got the same error while updating acquia_lift module from 3.7 to 3.9 & then Installing the module.

jasonawant’s picture

I don't think the patch is necessary or the right approach.

As #2 states, resaving the form will fix the issue b/c it will update how the configuration is saved.

This commit added bootstrap mode, but did not account for transitioning how this configuration was stored, leading to the PHP Notice.

This commit attempted to solve the issue, but the module could have used an update hook to change how current configuration is saved to database.

An update is probably the way to go to and do another point version release, however, the problem is solved by resaving the configuration form.

it-cru’s picture

I also think the patch should refactored to fix new added configuration settings via a hook_update_N() call. Also for new upcoming settings in the future.

it-cru’s picture

Status: Needs review » Needs work
ynx’s picture

There was an attempt to fix this issue but it might not have captured all the issues. Will look and get back to you guys shortly.

ynx’s picture

IT-Cru, I think your recommendation is the standard and best practice approach. In my last attempt, I have approached it without the update hook because we can fix it in code and without asking our customers to run an update hook, which was important to us. I think if we have a new fix today, we'll probably still take the code handling approach - hopefully not an ugly one.

jasonawant’s picture

Thanks for the update. Commit is here > http://cgit.drupalcode.org/acquia_lift/commit/?id=7290731d3200834b76c152....

Interesting to learn that acquia_lift commit message is "LEB-1848 | Fix PHP error when there is no 'bootstrap_mode' stored default value." which does not reference this D.O. issue #.

I guess LEB-1848 references some internal Jira issue # or something.

ynx’s picture

Yes, I can confirm with 4RoshniPatel.addweb and jasonawant that you are right, this needs to get fixed!

And thank you for the patch. I agree update hook is standard and best practice, but I would have taken your patch instead. Applying patch now.

ynx’s picture

Yes LEB-1848 was an internal ticket in an attempt to fix this error.

Applied and merged. Will release soon. Thank you all for the help!

ynx’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

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