Closed (fixed)
Project:
Smart Date
Version:
4.0.x-dev
Component:
Date Augmenter Integration
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
27 Oct 2022 at 02:01 UTC
Updated:
5 Mar 2023 at 09:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
mandclu commentedIt took a little doing to reproduce this error. Based on my testing it only seems to happen with newer versions of PHP (probably >= 8.0 but not sure) and an active augmenter.
I thought I could resolve this by making that method static, but that quickly turned into a rabbit hole. I may need to re-examine why it needs to be called statically.
Comment #3
jon.lund commentedI am using php 8.1.12
I had tried to make the method static and found the rabbit hole before posting here. (I should have added that to my original post.)
I uninstalled all augmentors and that did get rid of the error message and also allows the layout builder to work. I can live with this for now, we did enjoy using the Add to Cal link augmentor. We use the Smart Date extensively on our site and could not live without it.
Thank you for looking into this.
Comment #4
hhvardan commented@jon.lund please add more details how to reproduce the error.
I've upgraded module to 3.7-dev version and everything looks ok on D10, PHP version 8.1.10
Comment #5
jon.lund commentedThis seems to be where I run into problems:
This works:
You are welcome to view the site here
Comment #6
mandclu commentedPHP 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.
Comment #7
mandclu commentedHere'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.
Comment #8
chanelwheeler commentedI 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.
Comment #9
mandclu commented@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.
Comment #10
chanelwheeler commentedDrush cr is my first solution to everything. :) I applied the patch but I'm still getting the same error when I click Edit.
Comment #11
mandclu commentedHmmm if you go into the logged errors does it give you a stack trace at all?
Comment #12
chanelwheeler commentedUnfortunately not.
Comment #13
mandclu commentedSo 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? And are you using the 1.1.0-beta1 release for the Date Augmenter API?
Comment #14
chanelwheeler commentedI'm using 1.0 for both Add to Calendar and Date Augmenter. Should I upgrade?
Comment #15
mandclu commentedIf 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.
Comment #16
chanelwheeler commentedI upgraded both, cleared the cache, and went through the same steps. I still get the same error.
Comment #17
mandclu commentedIs 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?
Comment #18
chanelwheeler commentedI'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.
Comment #19
mandclu commentedI really appreciate your help in troubleshooting this. That most recent information was indeed helpful. Here's a new patch to try.
Comment #20
chanelwheeler commentedThank 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.
Comment #21
mandclu commentedWhat 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)
Comment #22
tobiasbsmart_date_recur does not define the service smart_date_recur.manager.
Comment #23
mandclu commentedIn 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.
Comment #24
mandclu commentedApologies, one more small tweak that may help with layout builder.
Comment #25
tobiasbLGTM.
Comment #26
chanelwheeler commentedI'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!!
Comment #27
mandclu commentedAwesome! Moving this to RTBC, but it would be great if anyone else in this thread has feedback.
Comment #28
chanelwheeler commentedOne 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.
Comment #30
mandclu commentedI've merged this into the 4.0.x branch. Thanks for everyone's help with this!
Comment #31
tobiasb@mandclu
Please also in 3.7.x + new release.
Comment #32
mandclu commentedIMHO 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.
Comment #33
tobiasbI 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.
Comment #34
mandclu commentedGood idea, I've added a comment about this to the releases notes for 3.7.0