- π¨π¦Canada mandclu
PHP 8.1 seems to be much more strict about mixing static and non-static code. In the 4.0.x branch I plan to remove the static availability of as many methods as possible, in favour of making services available instead. I decided to make this change as part of a new major version because this shift could be a breaking change for other code that expects these methods to be available statically.
- Status changed to Needs review
almost 2 years ago 11:08am 13 February 2023 - π¨π¦Canada mandclu
Here's a patch that seems to resolve the issue for me. This is targeted to 4.0.x for when it would be released but it should apply on the recent 3.7.0 release as well.
- πΊπΈUnited States chanelwheeler
I just ran into the same error while upgrading to 3.7. I have PHP 8.1 also. I applied the patch which fixed the problem when you click on the event in the calendar. However, if, for one of those events, I click the Edit tab, I get the error:
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "smart_date_recur.manager". Did you mean this: "smart_date.manager"? in Drupal\Component\DependencyInjection\Container->get() (line 157 of /var/www/html/yln/web/core/lib/Drupal/Component/DependencyInjection/Container.php).
I am using Add to Calendar Date Augmenter, Date Content Augmenter, and Date Augmenter.
- π¨π¦Canada mandclu
@chanelwheeler thanks for the feedback. Just to confirm, had you cleared the caches after applying the patch?
Here's a new patch, please let me know if it's any better with the new error.
- πΊπΈUnited States chanelwheeler
Drush cr is my first solution to everything. :) I applied the patch but I'm still getting the same error when I click Edit.
- π¨π¦Canada mandclu
Hmmm if you go into the logged errors does it give you a stack trace at all?
- π¨π¦Canada mandclu
So far I haven't been able to reproduce your error. Are you using the 1.1.0-alpha1 release for the Add to Calendar Date Augmenter?
- πΊπΈUnited States chanelwheeler
I'm using 1.0 for both Add to Calendar and Date Augmenter. Should I upgrade?
- π¨π¦Canada mandclu
If you don't mind trying it would be good to validate if the versions have any impact. I also tried uninstalling smart_date_recur on my side but I still can't get your error.
- πΊπΈUnited States chanelwheeler
I upgraded both, cleared the cache, and went through the same steps. I still get the same error.
- π¨π¦Canada mandclu
Is it possible for you to be more descriptive of the steps you're following? What calendar are you using? Do you have smart_date_recur enabled? One of the other comments mentioned Layout Builder. Are you using that?
- πΊπΈUnited States chanelwheeler
I'm using fullcalendar_view, datetime, and datetime_range as well as the aforementioned modules. I have Smart Date Recurring enabled. I don't have Layout Builder installed. The calendar itself is built in Views.
I have a pre-existing calendar with meetings. I am going to the calendar display page and clicking on one of the user group meetings. That brings up a view of all the upcoming dates for that user group. I click the Edit tab which would normally let me edit the dates and instead I get "The website encountered an unexpected error. Please try again later."
Just now I tried creating a new meeting and instead of providing a form, it gave me that same unexpected error. And now there's some meaty info in the logs.
Warning: Undefined variable $recur_manager in smart_date_recur_widget_extra_fields() (line 252 of /var/www/html/yln/web/modules/smart_date/modules/smart_date_recur/smart_date_recur.module) #0 /var/www/html/yln/web/core/includes/bootstrap.inc(347): _drupal_error_handler_real() #1 /var/www/html/yln/web/modules/smart_date/modules/smart_date_recur/smart_date_recur.module(252): _drupal_error_handler() #2 /var/www/html/yln/web/modules/smart_date/src/Plugin/Field/FieldWidget/SmartDateWidgetBase.php(161): smart_date_recur_widget_extra_fields() #3 /var/www/html/yln/web/modules/smart_date/src/Plugin/Field/FieldWidget/SmartDateDefaultWidget.php(110): Drupal\smart_date\Plugin\Field\FieldWidget\SmartDateWidgetBase->formElement() #4 /var/www/html/yln/web/modules/smart_date/src/Plugin/Field/FieldWidget/SmartDateInlineWidget.php(35): Drupal\smart_date\Plugin\Field\FieldWidget\SmartDateDefaultWidget->formElement() #5 /var/www/html/yln/web/core/lib/Drupal/Core/Field/WidgetBase.php(353): Drupal\smart_date\Plugin\Field\FieldWidget\SmartDateInlineWidget->formElement() #6 /var/www/html/yln/web/modules/smart_date/src/Plugin/Field/FieldWidget/SmartDateWidgetBase.php(492): Drupal\Core\Field\WidgetBase->formSingleElement() #7 /var/www/html/yln/web/core/lib/Drupal/Core/Field/WidgetBase.php(111): Drupal\smart_date\Plugin\Field\FieldWidget\SmartDateWidgetBase->formMultipleElements() #8 /var/www/html/yln/web/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php(183): Drupal\Core\Field\WidgetBase->form() #9 /var/www/html/yln/web/core/lib/Drupal/Core/Entity/ContentEntityForm.php(121): Drupal\Core\Entity\Entity\EntityFormDisplay->buildForm() #10 /var/www/html/yln/web/core/modules/node/src/NodeForm.php(127): Drupal\Core\Entity\ContentEntityForm->form() #11 /var/www/html/yln/web/core/lib/Drupal/Core/Entity/EntityForm.php(106): Drupal\node\NodeForm->form() #12 [internal function]: Drupal\Core\Entity\EntityForm->buildForm() #13 /var/www/html/yln/web/core/lib/Drupal/Core/Form/FormBuilder.php(534): call_user_func_array() #14 /var/www/html/yln/web/core/lib/Drupal/Core/Form/FormBuilder.php(281): Drupal\Core\Form\FormBuilder->retrieveForm() #15 /var/www/html/yln/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm() #16 [internal function]: Drupal\Core\Controller\FormController->getContentResult() #17 /var/www/html/yln/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array() #18 /var/www/html/yln/web/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #19 /var/www/html/yln/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext() #20 /var/www/html/yln/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() #21 /var/www/html/yln/vendor/symfony/http-kernel/HttpKernel.php(169): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #22 /var/www/html/yln/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw() #23 /var/www/html/yln/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle() #24 /var/www/html/yln/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle() #25 /var/www/html/yln/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle() #26 /var/www/html/yln/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass() #27 /var/www/html/yln/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle() #28 /var/www/html/yln/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() #29 /var/www/html/yln/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() #30 /var/www/html/yln/web/core/lib/Drupal/Core/DrupalKernel.php(713): Stack\StackedHttpKernel->handle() #31 /var/www/html/yln/web/index.php(19): Drupal\Core\DrupalKernel->handle() #32 {main}
Error: Call to a member function getThirdPartyFallback() on null in smart_date_recur_widget_extra_fields() (line 252 of /var/www/html/yln/web/modules/smart_date/modules/smart_date_recur/smart_date_recur.module) #0 /var/www/html/yln/web/modules/smart_date/src/Plugin/Field/FieldWidget/SmartDateWidgetBase.php(161): smart_date_recur_widget_extra_fields() #1 /var/www/html/yln/web/modules/smart_date/src/Plugin/Field/FieldWidget/SmartDateDefaultWidget.php(110): Drupal\smart_date\Plugin\Field\FieldWidget\SmartDateWidgetBase->formElement() #2 /var/www/html/yln/web/modules/smart_date/src/Plugin/Field/FieldWidget/SmartDateInlineWidget.php(35): Drupal\smart_date\Plugin\Field\FieldWidget\SmartDateDefaultWidget->formElement() #3 /var/www/html/yln/web/core/lib/Drupal/Core/Field/WidgetBase.php(353): Drupal\smart_date\Plugin\Field\FieldWidget\SmartDateInlineWidget->formElement() #4 /var/www/html/yln/web/modules/smart_date/src/Plugin/Field/FieldWidget/SmartDateWidgetBase.php(492): Drupal\Core\Field\WidgetBase->formSingleElement() #5 /var/www/html/yln/web/core/lib/Drupal/Core/Field/WidgetBase.php(111): Drupal\smart_date\Plugin\Field\FieldWidget\SmartDateWidgetBase->formMultipleElements() #6 /var/www/html/yln/web/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php(183): Drupal\Core\Field\WidgetBase->form() #7 /var/www/html/yln/web/core/lib/Drupal/Core/Entity/ContentEntityForm.php(121): Drupal\Core\Entity\Entity\EntityFormDisplay->buildForm() #8 /var/www/html/yln/web/core/modules/node/src/NodeForm.php(127): Drupal\Core\Entity\ContentEntityForm->form() #9 /var/www/html/yln/web/core/lib/Drupal/Core/Entity/EntityForm.php(106): Drupal\node\NodeForm->form() #10 [internal function]: Drupal\Core\Entity\EntityForm->buildForm() #11 /var/www/html/yln/web/core/lib/Drupal/Core/Form/FormBuilder.php(534): call_user_func_array() #12 /var/www/html/yln/web/core/lib/Drupal/Core/Form/FormBuilder.php(281): Drupal\Core\Form\FormBuilder->retrieveForm() #13 /var/www/html/yln/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm() #14 [internal function]: Drupal\Core\Controller\FormController->getContentResult() #15 /var/www/html/yln/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array() #16 /var/www/html/yln/web/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #17 /var/www/html/yln/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext() #18 /var/www/html/yln/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() #19 /var/www/html/yln/vendor/symfony/http-kernel/HttpKernel.php(169): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #20 /var/www/html/yln/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw() #21 /var/www/html/yln/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle() #22 /var/www/html/yln/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle() #23 /var/www/html/yln/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle() #24 /var/www/html/yln/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass() #25 /var/www/html/yln/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle() #26 /var/www/html/yln/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() #27 /var/www/html/yln/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() #28 /var/www/html/yln/web/core/lib/Drupal/Core/DrupalKernel.php(713): Stack\StackedHttpKernel->handle() #29 /var/www/html/yln/web/index.php(19): Drupal\Core\DrupalKernel->handle() #30 {main}
- π¨π¦Canada mandclu
I really appreciate your help in troubleshooting this. That most recent information was indeed helpful. Here's a new patch to try.
- πΊπΈUnited States chanelwheeler
Thank YOU for being so helpful. We're dependent on this module.
I installed the new patch, cleared the cache, and tried both editing and creating, and I still get the same errors for each.
- π¨π¦Canada mandclu
What version of Drupal is the site on BTW?
A couple of other potential things to try:
- truncate the cache tables (make sure you do a full backup first)
- install the Whoops module to see if it has any new insight (doubtful if the stack trace is the same for the errors you're seeing) - π©πͺGermany tobiasb Berlin
smart_date_recur does not define the service smart_date_recur.manager.
- π¨π¦Canada mandclu
In my sleep deprived state yesterday I forgot that making a patch which creates new files requires an extra step. Here's a new patch that should ACTUALLY define the new service.
- π¨π¦Canada mandclu
Apologies, one more small tweak that may help with layout builder.
- πΊπΈUnited States chanelwheeler
I'm on Drupal 9.5.3. Patch 24 fixed the problem! I confirmed that I can edit and save a meeting, and that I can create a new meeting. No problems in the logs. Thank you!!
- Status changed to RTBC
almost 2 years ago 4:29pm 14 February 2023 - π¨π¦Canada mandclu
Awesome! Moving this to RTBC, but it would be great if anyone else in this thread has feedback.
- πΊπΈUnited States chanelwheeler
One more thing to add. I installed this with the patch on the production server which is still on the stable releases of Add to Calendar and Date Augmenter. The patch works there so for anyone following this thread, you don't need the alpha/beta to get this to work.
-
mandclu β
committed 3ff40846 on 4.0.x
Issue #3317694 by mandclu, chanelwheeler, tobiasb: Error: Non-static...
-
mandclu β
committed 3ff40846 on 4.0.x
- Status changed to Fixed
almost 2 years ago 5:39pm 14 February 2023 - π¨π¦Canada mandclu
I've merged this into the 4.0.x branch. Thanks for everyone's help with this!
- π©πͺGermany tobiasb Berlin
@mandclu
Please also in 3.7.x + new release.
- π¨π¦Canada mandclu
IMHO the removal of the ability to call a number of functions statically is a compatibility-breaking change, and as such should only be undertaken in a major version change. I'm hoping to have a first release of the 4.0.x branch in the coming days, but if you need something in the meantime I'm afraid you'll have to use the patch for now.
- π©πͺGermany tobiasb Berlin
I know. We need a separate fix or at least a warning in the release notes that part of the software (smart_date_recur: field formatter) does not work without this patch in php >= 8.0.
- π¨π¦Canada mandclu
Good idea, I've added a comment about this to the releases notes for 3.7.0
-
mandclu β
committed c6fe3426 on 4.0.x
Revert "Issue #3317694 by mandclu, chanelwheeler, tobiasb: Error: Non-...
-
mandclu β
committed c6fe3426 on 4.0.x
-
mandclu β
committed 76588a86 on 4.0.x
Reinstate "Issue #3317694 by mandclu, chanelwheeler, tobiasb: Error: Non...
-
mandclu β
committed 76588a86 on 4.0.x