• Resolved johnsd

    (@johnsd)


    Hello,

    We are getting the following error when running our site in PHP 7. Do you have any ideas what could be causing it?

    Fatal error: Uncaught TypeError: Argument 1 passed to Ai1ec_Exception_Handler::handle_exception() must be an instance of Exception, instance of ParseError given in /srv/bindings/d89e28026ae44d28a3d4193c3a4a0afe/code/wp-content/plugins/all-in-one-event-calendar/lib/exception/handler.php:191 Stack trace: #0 [internal function]: Ai1ec_Exception_Handler->handle_exception(Object(ParseError)) #1 {main} thrown in /srv/bindings/d89e28026ae44d28a3d4193c3a4a0afe/code/wp-content/plugins/all-in-one-event-calendar/lib/exception/handler.php on line 191

    Thanks!
    John

Viewing 9 replies - 1 through 9 (of 9 total)
  • Yes, I saw that exact error on the exact same line.

    It’s that “Throwable” thing, and how php 7 handles errors and exceptions.

    https://wordpress.org/support/topic/exception-handle-php-7/

    After reviewing my notes, I believe that the problem is that ai1ec is registering to handle all exceptions. That handle_exception() method handles all exceptions, even ones that are not coming fron ai1ec. The problem is, it generates that fatal error, so you can’t see what the error is coming from.

    Cjhaas’ solution was to remove the “Exception” type hint.

    I believe the way I got around this was to remove the type hint, to get rid of the fatal error. Then, var_dump the exception in line 192. Figure out where the error’s coming from. (My error came from outside ai1ec.) Fix that error, then change the the ai1ec code back.

    I feel like this is something they should fix.

    • This reply was modified 7 years, 1 month ago by nluis3294.

    Please refer to this article for the solution:

    https://wordpress.org/support/topic/exception-handle-php-7/

    [ Moderator note: Signature redacted. ]

    Thread Starter johnsd

    (@johnsd)

    Thank you, Sunny!

    Milla

    (@mekaselska)

    Hi, is there going to be a fix from plugin side? My Theme options page went blank and when I enabled debugging, I saw

    Fatal error: Uncaught TypeError: Argument 1 passed to Ai1ec_Exception_Handler::handle_exception() must be an instance of Exception, instance of Error given in /data/wordpress/htdocs/wp-content/plugins/all-in-one-event-calendar/lib/exception/handler.php:191

    on the Theme options page. If I understood the above correctly, the error might be anything but now the calendar is handling it.

    Sunny Lal

    (@sunny454)

    Hi @mekaselska,

    Yes, there is. In fact there is a new release scheduled for today (March 17, 2017).

    Please follow these instructions to do a manual upgrade:

    – Backup your current events by scrolling down to the bottom of your calendar and click on the [Subscribe] button, then click on “Add to Timely Calendar” and download the events file (download.ics).
    – Delete the file uninstall.php from the plugin directory that is currently on the server (found under /wp-content/plugins/all-in-one-event-calendar). Deleting this file ensures that when you uninstall the current version of the plugin, your event data and calendar settings will be preserved when you delete the plugin (don’t skip this step – it’s important!)
    – Deactivate the All-in-One Event Calendar using your WordPress Dashboard.
    – Delete the All-in-One Event Calendar using your WordPress Dashboard.
    – Database -> wp_options, click option_name to sort and delete everything with ai1ec_, this will delete plugin settings but events will remain in the database.
    – Now install the latest version.

    For faster assistance, please log into your Timely account and open a ticket by clicking on the Get Help link, or click here: https://dashboard.time.ly/account/get-help.

    [ Moderator note: Signature redacted. ]

    @sunny454; I still revieve the following error:

    Fatal error: Uncaught TypeError: Argument 1 passed to Ai1ec_Exception_Handler::handle_exception() must be an instance of Exception, instance of Error given in /<ROOTPATH>/public_html/wp-content/plugins/all-in-one-event-calendar/lib/exception/handler.php:198 Stack trace: #0 [internal function]: Ai1ec_Exception_Handler->handle_exception(Object(Error)) #1 {main} thrown in /<ROOT PATH>/public_html/wp-content/plugins/all-in-one-event-calendar/lib/exception/handler.php on line 197

    Code in handler.php line 197-ish:

    	public function handle_exception( Exception $exception ) {
    		if ( defined( 'AI1EC_DEBUG' ) && true === AI1EC_DEBUG ) {
    		echo '<pre>';
    			$this->var_debug( $exception );
    			echo '</pre>';
    			die();
    		}
    

    tried changing to:

       public function handle_exception( $exception ) {
        if( $exception instanceof \Error ) {
            throw new \Exception( 'Exception re-throw', 0, $exception );
        }
        if ( defined( 'AI1EC_DEBUG' ) && true === AI1EC_DEBUG ) {
    

    as per http://cjhaas.com/blog/2017/02/24/one-event-calendar-time-ly-exceptionerror-problem/

    Is this solution still the way to solve this issue or is there anything else I should do (since post is couple of months old and you mentioned a new release)

    I’m using Ai1ec version 2.5.22

    Many thanks in advance!

    • This reply was modified 6 years, 8 months ago by iamXnl. Reason: changed addressee (@sunny454) to correct user

    Hi @iamxnl

    You can try having your host revert back to PHP versin 5.6 which is apparently more stable and causes a lot fewer problems.

    I would like to bump this as I’m having this issue too – I tried the update suggested on line 191 however that then caused a new error. I’m running PHP 7.1 and to suggest downgrading to 5.6

    1) WordPress.org recommends PHP 7 or greater
    2) PHP 5.6 was EOL active Support back in January and 7.0 is in another week
    3) This started when using Ad Rotate and trying to save a banner, however, as per displaying errors, the error is coming from AI1EC

    Thank you for your help

    Hi @sflwa,

    This error is most likely a result of a plugin or theme conflict (usually caused by a caching or security plugin).. Please try a different theme temporarily such as Twenty Seventeen, or, disable all plugins and then check if the problem recurrs — then re-enable each one until you find which one caused the problem.

    If you are still experiencing problems, please log into your Timely account and open a ticket by clicking on the Get Help link, or click here: https://dashboard.time.ly/account/get-help.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘PHP 7 Error’ is closed to new replies.