Title: PHP error when trying to disable jetpack modules
Last modified: October 26, 2022

---

# PHP error when trying to disable jetpack modules

 *  Resolved [webwitnl](https://wordpress.org/support/users/webwitnl/)
 * (@webwitnl)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/php-error-when-trying-to-disable-jetpack-modules/)
 * Hi, I run the latest of WordPress and Woocommerce. When I go to the Jetpack dashboard,
   scroll to the bottom and click Modules, I can activate or deactivate modules.
 * Whatever module I try to deactivate, I get a critical error.
 * Looking at the php error log, I see the stack trace below. It is the log() function
   which tries to do “$log = array_slice( Jetpack_Options::get_option( ‘log’, array()),-
   199, 199 );” but get_option(‘log’) apparently gives boolean false.
 * PHP Fatal error: Uncaught TypeError: array_slice(): Argument #1 ($array) must
   be of type array, bool given in /home/xxx/public_html/wp-content/plugins/jetpack/
   class.jetpack.php:3086
 * Stack trace:
 * #0 /home/xxx/public_html/wp-content/plugins/jetpack/class.jetpack.php(3086): 
   array_slice(false, -199, 199)
 * #1 /home/xxx/public_html/wp-content/plugins/jetpack/class.jetpack.php(4014): 
   Jetpack::log(‘deactivate’, ‘stats’)
 * #2 /home/xxx/public_html/wp-content/plugins/jetpack/_inc/lib/admin-pages/class.
   jetpack-admin-page.php(171): Jetpack->admin_page_load()
 * #3 /home/xxx/public_html/wp-includes/class-wp-hook.php(307): Jetpack_Admin_Page-
   >admin_page_load(”)
 * #4 /home/xxx/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(
   NULL, Array)
 * #5 /home/xxx/public_html/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
 * #6 /home/xxx/public_html/wp-admin/admin.php(237): do_action(‘load-toplevel_p…’)
 * #7 {main}
    thrown in /home/xxx/public_html/wp-content/plugins/jetpack/class.jetpack.
   php on line 3086

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [Bruce (a11n)](https://wordpress.org/support/users/bruceallen/)
 * (@bruceallen)
 * Happiness Engineer
 * [3 years, 6 months ago](https://wordpress.org/support/topic/php-error-when-trying-to-disable-jetpack-modules/#post-16136865)
 * Hi [@webwitnl](https://wordpress.org/support/users/webwitnl/)
 * Could you please post your site URL here so that we can have a look?
 * If you want it to remain private, you can also contact us [via this contact form](https://jetpack.com/contact-support/?rel=support&hpi=1).
   If you choose to reach out directly, please include a link to this thread.
 * Thanks!
 *  Thread Starter [webwitnl](https://wordpress.org/support/users/webwitnl/)
 * (@webwitnl)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/php-error-when-trying-to-disable-jetpack-modules/#post-16138284)
 * Hi Bruce, it’s [https://www.wildewolf.nl/](https://www.wildewolf.nl/)
    Thanks!
 *  Plugin Contributor [Dan (a11n)](https://wordpress.org/support/users/drawmyface/)
 * (@drawmyface)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/php-error-when-trying-to-disable-jetpack-modules/#post-16152937)
 * Hi there
 * Thanks for sending the stack trace, that’s a big help.
 * It seems like something has hooked “jetpack_options” and is returning false. 
   Or else something earlier in the request is consistently setting false for the
   relevant option. The fact that it’s getting false indicates it’s not something
   stored in the database, as trying to store false here would come back as the 
   empty string instead.
 * I think we need to rule out a conflict with another plugin/theme at this point.
   Would you be able to deactivate all other plugins and switch to a default theme(
   you could use a staging site, or try the troubleshooting mode of the Health Check
   plugin if you don’t want to do it on your live site).
 * You could also try searching the source code of any active plugins for references
   to strings `jetpack_options`, `jetpack_log`, or a string `log` being passed to
   methods on class `Jetpack_Options` as a starting point.
 * Please let us know what you find.
 *  Thread Starter [webwitnl](https://wordpress.org/support/users/webwitnl/)
 * (@webwitnl)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/php-error-when-trying-to-disable-jetpack-modules/#post-16153555)
 * I did a bit of digging and traced the flow of code.
 * The problem is the code calls a function maybe_unserialize() in wp-includes/functions.
   php, which calls php’s unserialize() with the value of jetpack_log in database
   table wp_options.
 * There’s a serialized string in that database field, but unserialize gives an 
   error and returns bool false.
 * PHP throws this notice:
    Notice – unserialize(): Error at offset 2045 of 36021
   bytes
 * Looking at the string at offset 2045, I see nothing special. The field is a proper
   longtext in utf8mb4_unicode_ci and isn’t cut off. I also tested the string somewhere
   else at [http://php.fnlist.com/php/unserialize](http://php.fnlist.com/php/unserialize)
   where it gives the same error at offset 2045.
 * If you want I can privately share the string with you.
    -  This reply was modified 3 years, 6 months ago by [webwitnl](https://wordpress.org/support/users/webwitnl/).
 *  Thread Starter [webwitnl](https://wordpress.org/support/users/webwitnl/)
 * (@webwitnl)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/php-error-when-trying-to-disable-jetpack-modules/#post-16153603)
 * Found it. Before offset 2045 the serialized string does something like this:
 * s:71:”/home/xxxxxxxxx/public_html/wp-content/upgrade/wordpress-5.9-nl_nl/”
 * That string is not 71 characters long but 67.
 * I fixed it in the database, but then it failed on a next path with also a length
   4 characters too long:
 * s:52:”/home/xxxxxxxxx/public_html/wp-content/languages”
 * It’s 48 characters.
 * I never changed paths nor the xxxxxxxxx part.
 * Hmmm….
 *  Plugin Support [lastsplash (a11n)](https://wordpress.org/support/users/lastsplash/)
 * (@lastsplash)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/php-error-when-trying-to-disable-jetpack-modules/#post-16160936)
 * Hi [@webwitnl](https://wordpress.org/support/users/webwitnl/) –
 * Thanks for the additional information.
 * Our development team believes the values in your database are subtly corrupted
   and that is what is causing the issue. The `maybe_unserialize()` identified (
   presumably the one [here](https://github.com/WordPress/WordPress/blob/c1beb8d2b85c79027a1b6057ab17916944b6144c/wp-includes/option.php#L229))
   is already inside WordPress core, not in Jetpack. It seems unlikely to have been
   Jetpack doing it as all accesses in Jetpack code for this option will go through
   the WordPress core functions.
 * It should be ok for you to just delete the row from the database, it’ll just 
   lose some logging information. That said, it is always a good idea to back up
   your site before modifying the database so that you can restore your site if 
   something goes awry.
 * After that, if can reproduce the problem again reliably, you might check whether
   what is going into the database ([here](https://github.com/WordPress/WordPress/blob/c1beb8d2b85c79027a1b6057ab17916944b6144c/wp-includes/option.php#L475)
   or [here](https://github.com/WordPress/WordPress/blob/c1beb8d2b85c79027a1b6057ab17916944b6144c/wp-includes/option.php#L627))
   matches what is coming out.
 *  Thread Starter [webwitnl](https://wordpress.org/support/users/webwitnl/)
 * (@webwitnl)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/php-error-when-trying-to-disable-jetpack-modules/#post-16160965)
 * Yeah it’s a weird one. I can think of two possibilities, one is serialize() used
   to be famously bugged especially with nested arrays, but that was years ago and
   surely fixed with PHP8 we’re running. And two, maybe it was manually edited at
   the beginning by someone when we set up the site on dev and moved to prod, but
   the filepaths on dev are much longer and doesn’t explain 4 characters.
 * Anyway, I fixed the lengths of the paths manually, and it works now. Thanks for
   your time and help!
    -  This reply was modified 3 years, 6 months ago by [webwitnl](https://wordpress.org/support/users/webwitnl/).
 *  Plugin Support [lastsplash (a11n)](https://wordpress.org/support/users/lastsplash/)
 * (@lastsplash)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/php-error-when-trying-to-disable-jetpack-modules/#post-16160990)
 * You are welcome!
 * I’m going to mark this thread as resolved. If you need assistance with Jetpack
   in the future, feel free to open a new thread.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘PHP error when trying to disable jetpack modules’ is closed to new replies.

 * ![](https://ps.w.org/jetpack/assets/icon.svg?rev=2819237)
 * [Jetpack - WP Security, Backup, Speed, & Growth](https://wordpress.org/plugins/jetpack/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/jetpack/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/jetpack/)
 * [Active Topics](https://wordpress.org/support/plugin/jetpack/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/jetpack/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/jetpack/reviews/)

 * 8 replies
 * 4 participants
 * Last reply from: [lastsplash (a11n)](https://wordpress.org/support/users/lastsplash/)
 * Last activity: [3 years, 6 months ago](https://wordpress.org/support/topic/php-error-when-trying-to-disable-jetpack-modules/#post-16160990)
 * Status: resolved