Jump to content

Error: Call to undefined method DateTime


Go to solution Solved by Robert Angle,

Recommended Posts

Posted

I upgraded to PHP 8.1 in preparation for the next IPS release. Now I occasionally see this error...

Error: Call to undefined method DateTime::getDateInformation() (0)
#0 /home/jwtalk/public_html/applications/calendar/sources/Event/Event.php(363): IPS\calendar\_Event::_findOccurances(Object(IPS\calendar\Date), Object(IPS\calendar\Date), Object(IPS\calendar\Date), Object(IPS\calendar\Date), Array)
#1 /home/jwtalk/public_html/applications/calendar/sources/Event/Event.php(2127): IPS\calendar\_Event->findOccurrences(Object(IPS\calendar\Date), Object(IPS\calendar\Date))
#2 /home/jwtalk/public_html/applications/calendar/widgets/upcomingEvents.php(153): IPS\calendar\_Event::retrieveEvents(Object(IPS\calendar\Date), Object(IPS\calendar\Date), NULL, 5, false)
#3 /home/jwtalk/public_html/system/Widget/Widget.php(833): IPS\calendar\widgets\_upcomingEvents->render()
#4 /home/jwtalk/public_html/system/Widget/Widget.php(888): IPS\_Widget->_render()
#5 /home/jwtalk/public_html/uploads/template_41_94a9d7649fb9cdbfc784d3516e61a717_global.php(18464): IPS\_Widget->__toString()
#6 /home/jwtalk/public_html/system/Theme/SandboxedTemplate.php(61): IPS\Theme\Cache\class_core_front_global->widgetContainer('sidebar', 'vertical')
#7 /home/jwtalk/public_html/uploads/template_41_94a9d7649fb9cdbfc784d3516e61a717_global.php(15713): IPS\Theme\_SandboxedTemplate->__call('widgetContainer', Array)
#8 /home/jwtalk/public_html/system/Theme/SandboxedTemplate.php(61): IPS\Theme\Cache\class_core_front_global->sidebar('right')
#9 /home/jwtalk/public_html/uploads/template_41_94a9d7649fb9cdbfc784d3516e61a717_global.php(6771): IPS\Theme\_SandboxedTemplate->__call('sidebar', Array)
#10 /home/jwtalk/public_html/system/Theme/SandboxedTemplate.php(61): IPS\Theme\Cache\class_core_front_global->globalTemplate('JWTalk - Jehova...', '\n\n<div class='i...', Array)
#11 /home/jwtalk/public_html/system/Dispatcher/Dispatcher.php(173): IPS\Theme\_SandboxedTemplate->__call('globalTemplate', Array)
#12 /home/jwtalk/public_html/system/Dispatcher/Standard.php(113): IPS\_Dispatcher->finish()
#13 /home/jwtalk/public_html/system/Dispatcher/Front.php(625): IPS\Dispatcher\_Standard->finish()
#14 /home/jwtalk/public_html/system/Dispatcher/Dispatcher.php(155): IPS\Dispatcher\_Front->finish()
#15 /home/jwtalk/public_html/index.php(13): IPS\_Dispatcher->run()
#16 {main}

 

What could be causing it? 

Posted

OK. Let’s check first to make sure you have all of the required modules when running 8.1:

Download and run that.  If anything is in red, you know what you need to fix. 

Assuming it comes back clean, you can attempt to run the updater again. Just visit domain.com/admin/upgrade

If it says there is nothing to update, the files never extracted properly. You can download them from your client area on this site, upload them, then run the updater that I noted above again. 

Let’s see if that gets you rolling in the right direction. If it does not work, we can use recovery mode to disable all your 3rd party resources as one of those may be interfering with things. 

Posted

OK. It’s most likely a third party resource causing problems.  Let’s get them all disabled. 

In a nutshell, you’re going to add an extra value to your constants.php file or create a new one if it does not yet exist. 

Once you upload it, use a new browser (or pop your cache) to login to the ACP. You’ll get a message about resources being disabled. Once done, remove the change to the constants.php file (or delete it if it was new).  That should hopefully get you back in.

Once done, enable third party resources one by one till you find the culprit. 

  • Solution
Posted

Turns out the problem was an old 3rd party plugin "Go to top" or "To the top" or something like that, which would put a little up arrow in the bottom corner of the screen which would send you back up to the top of the page when you clicked on it. It's gone, and now I just get to wait and see how long it takes for someone to complain about it missing, lol.

Posted
22 minutes ago, Robert Angle said:

Turns out the problem was an old 3rd party plugin "Go to top" or "To the top" or something like that, which would put a little up arrow in the bottom corner of the screen which would send you back up to the top of the page when you clicked on it. It's gone, and now I just get to wait and see how long it takes for someone to complain about it missing, lol.

I'm glad you were able to find the culprit!  Just in case your members complain, there looks to be a couple of different resources in the marketplace that can add this functionality, so you can check for a different one that is compatible with PHP8.  

Posted
On 10/29/2022 at 1:54 AM, Robert Angle said:

...........and see how long it takes for someone to complain about it missing, lol.

I actually did this on my own site years ago, and removed small things bit at a time. Its surprising how many things people dont notice lol

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...