Support » Plugin: Jetpack - WP Security, Backup, Speed, & Growth » “jetpack_check_mobile” error message after update to 8.3

  • Resolved mos8580

    (@mos8580)


    After updating to Jetpack 8.3 the following PHP error message appears on top of the screen (both on frontpage and in the admin panel) and breaks the layout of the site:

    “Notice: jetpack_check_mobile used for an anonymous function is deprecated since version with no alternative available. in …/public_html/wp-includes/functions.php on line 4651”

    If you make a Google search for “Notice: jetpack_check_mobile used for an anonymous function” you’ll find serveral affected sites showing this error message (some of them fixed now but still cached by Google), so it’s not just me. The exact URL and line number may differ from site to site, but the URL always ends with “wp-includes/functions.php”.

    I have rolled back to version 8.2.3 of Jetpack until this issue is resolved.
    I’m using the free version of WPtouch Mobile Plugin (version 4.3.37) if that does matter. Also running the latest version of WordPress (5.3.2) on PHP 7.1.

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Support KokkieH

    (@kokkieh)

    Hi there,

    Can you give a link to your site?

    This might be related to the Jetpack mobile theme. This theme was created for use with old themes that don’t have a mobile responsive version and was deprecated in Jetpack 8.3, though I can’t think why it would show that error right on the front page.

    Please check at Jetpack ->Settings ->Writing if the mobile theme is active under Theme Enhancements. If it is, see if disabling it and then updating Jetpack back to 8.3 still causes that error to appear.

    Thread Starter mos8580

    (@mos8580)

    Hi,

    I’ve managed to narrow this down to what seems to be a plugin conflict between Jetpack 8.3 and WPtouch Mobile 4.3.37 (which btw was last updated 11 months ago). If I disable the WPtouch Mobile Plugin the error message disappears. But I don’t like the layout of the default WordPress mobile theme so I depend on WPtouch.

    I prefer not to publish my site URL in public, but here are some of the other affected sites I’ve found that are still showing the error message:

    https://rf-naturephotography.com/
    https://www.ds-lighting.de/
    https://www.pristinefinefoods.com/

    At least one of them seems to be using the WPtouch Mobile plugin.

    The mobile theme settings were grayed out in “Jetpack ->Settings ->Writing” so I couldn’t change anything there (Jetpack 8.2.3), but it was already set to “off”. Updating to 8.3 again didn’t help, but disabling WPtouch did, as mentioned above.

    Plugin Contributor James Huff

    (@macmanx)

    Volunteer Moderator

    You might want to see if your site is just fine without the mobile plugin.

    All themes developed in the past 5 years have been fully responsive, meaning they adapt to all screen sizes on their own.

    Because of this, we’ll actually be discontinuing Jetpack’s own mobile theme soon.

    Thanks @mos8580 for figuring out the plugin conflict, because I see this error all the time.

    WPTouch is tricky in timing, and also because it changes the active theme on the fly. Very hard to work with from a developer’s point of view. (For a challenge, try using it with WooCommerce.) If I figure out how to fix the Jetpack-WPTouch conflict, I’ll report back.

    Yes, people should switch to a responsive theme, but that is not the answer. WPTouch or Jetpack or WP core should fix this.

    OK, there may be two bugs here, one in Jetpack and one in WPTouch.

    1. Jetpack.
    add_action( 'init', array( $this, 'deprecated_hooks' ) );
    IS THE LOGIC REVERSED BELOW?

    public function deprecated_hooks() {
    	// ...
    	if ( is_callable( $hooked['function'] ) ) {
    		$function_name = 'an anonymous function';
    	} else {
    		$function_name = $hooked['function'];
    	}
    	// ...
    }

    2. WPTouch
    add_filter( 'jetpack_check_mobile', 'foundation_override_jetpack_check_mobile' );
    Should be
    add_filter( 'pre_jetpack_is_mobile', 'foundation_override_jetpack_check_mobile');

    • This reply was modified 1 year, 1 month ago by .
    • This reply was modified 1 year, 1 month ago by .
    Plugin Contributor James Huff

    (@macmanx)

    Volunteer Moderator

    That first one wouldn’t be affecting this, overall this is something that will need to be fixed on WPTouch’s end.

    They’re checking to see if the module is enabled or not, but since the module no longer exists, they’re erroring out rather than failing gracefully.

    @macmanx, it’s a bug in Jetpack 8.3. If you fix lines 6515-6519 as follows:

    	if ( is_callable( $hooked['function'] ) ) {
    		$function_name = $hooked['function'];
    	} else {
    		$function_name = 'an anonymous function';
    	}

    Then the error output under WP_DEBUG is fixed:

    BEFORE FIX:

    Deprecated: jetpack_check_mobile used for an anonymous function is deprecated since version with no alternative available. in /home/…/public_html/wp-includes/functions.php on line 4723

    AFTER FIX:

    Deprecated: jetpack_check_mobile used for foundation_override_jetpack_check_mobile is deprecated since version with no alternative available. in /home/…/public_html/wp-includes/functions.php on line 4723

    • This reply was modified 1 year, 1 month ago by .
    • This reply was modified 1 year, 1 month ago by .
    • This reply was modified 1 year, 1 month ago by .
    Plugin Contributor James Huff

    (@macmanx)

    Volunteer Moderator

    Done. The Jetpack aspect of this, an error message reporting mini-bug, will be fixed in a future release. All it does is make the error report more specific. https://github.com/Automattic/jetpack/issues/15308

    So WPTouch still should fix its bug and stop filling up our error_log’s!

    bruceparker1

    (@bruceparker1)

    Is this error message now fixed in the new JetPack 8.4.1? I have the same problem, and so I have been stuck using JetPack 8.2.3.

    When I first attempted to update to JetPack 8.3., which no longer has a mobile theme option, it triggered this error message on all pages of my website:

    Notice: jetpack_check_mobile used for an anonymous function is deprecated since version with no alternative available. in /home/asahk7k15tad/public_html/wp-includes/functions.php on line 4651

    When I deactivate WPtouch, the error goes away. When I re-activate WPtouch, it comes back.

    Please let me know if this JetPack bug is now fixed in the new JetPack 8.4.1

    Or, does WPTouch has to fix this to make the error message go away from my site?

    Thanks!

    kitchin

    (@kitchin)

    Until Jetpack releases 8.4.2, there is a temporary fix: download as a zip, install and activate this plugin. See the linked instructions:
    https://gist.github.com/westonruter/d168c290d6c01c107da960d48fa3dad3

    bruceparker1

    (@bruceparker1)

    Hi Kitchin, could you let me know what, specifically, will be fixed in 8.4.2 regarding this issue? Namely, will the error message be gone?

    I don’t have much faith that WPtouch will be making any fixes soon. They’re a little slow in terms of tech support.

    kitchin

    (@kitchin)

    @bruceparker1 The fix went into Jetpack 8.5. All it does is correct the error message so that is tells you the name of the function, instead of saying it is an anonymous function.

    The fix for WPTouch is as follows.

    wp-plugins/wptouch/themes/foundation/root-functions.php
    Replace lines 24-25 with:

    // fix for JetPack
    // xxx Patch, see https://wordpress.org/support/topic/jetpack_check_mobile-error-message-after-update-to-8-3/
    // add_filter( 'jetpack_check_mobile', 'foundation_override_jetpack_check_mobile' );  // xxx del 
    add_filter( 'pre_jetpack_is_mobile', 'foundation_override_jetpack_check_mobile' );  // xxx add
    // xxx End of patch.
Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘“jetpack_check_mobile” error message after update to 8.3’ is closed to new replies.