Jetpack: Notice: Automattic\Jetpack\Sync\Functions was called incorrectly.

Created on 14 Jul 2019  Â·  17Comments  Â·  Source: Automattic/jetpack


This message is being issued every now and then in a local exact clone of the live site.

Notice: Automattic\Jetpack\Sync\Functions was called incorrectly. Not all plugins have loaded yet but we requested the class Automattic\Jetpack\Sync\Functions Please see Debugging in WordPress for more information. (This message was added in version dev-add/jetpack-compat-package.) in C:\apache\htdocs\srab\wp-includes\functions.php on line 4773

Steps to reproduce the issue

  1. Clone a live site to a local instance.
  2. Confirm that it's an exact copy
  3. Keep using it with Jetpack activated and WP_DEBUG true
  4. See error every now and then

What I expected


No Notices

What happened instead

The message was produced every now and then.
Stack trace for doing_it_wrong_run.

0. bw_lazy_backtrace C:\apache\htdocs\wordpress\wp-content\plugins\oik-bwtrace\libs\bwtrace.php:108 0
1. bw_backtrace C:\apache\htdocs\wordpress\wp-content\plugins\oik-bwtrace\includes\bwtrace-actions.php:191 0
2. bw_trace_doing_it_wrong_run(Automattic\Jetpack\Sync\Functions,Not all plugins have loaded yet but we requested the class Automattic\Jetpack\Sync\Functions,dev-add/jetpack-compat-package) C:\apache\htdocs\srab\wp-includes\class-wp-hook.php:286 3
3. apply_filters(,array) C:\apache\htdocs\srab\wp-includes\class-wp-hook.php:310 2
4. do_action(array) C:\apache\htdocs\srab\wp-includes\plugin.php:465 1
5. do_action(doing_it_wrong_run,Automattic\Jetpack\Sync\Functions,Not all plugins have loaded yet but we requested the class Automattic\Jetpack\Sync\Functions,dev-add/jetpack-compat-package) C:\apache\htdocs\srab\wp-includes\functions.php:4746 4
6. _doing_it_wrong(Automattic\Jetpack\Sync\Functions,Not all plugins have loaded yet but we requested the class Automattic\Jetpack\Sync\Functions,dev-add/jetpack-compat-package) C:\apache\htdocs\wordpress\wp-content\plugins\jetpack\vendor\autoload_packages.php:102 3
7. Automattic\Jetpack\Autoloader\autoloader(Automattic\Jetpack\Sync\Functions) C:\apache\htdocs\wordpress\wp-content\plugins\jetpack\vendor\autoload_packages.php:0 1
8. spl_autoload_call(Automattic\Jetpack\Sync\Functions) C:\apache\htdocs\wordpress\wp-content\plugins\jetpack\class.jetpack.php:6192 1
9. get_sync_error_idc_option C:\apache\htdocs\wordpress\wp-content\plugins\jetpack\class.jetpack.php:6133 0
10. validate_sync_error_idc_option C:\apache\htdocs\wordpress\wp-content\plugins\jetpack\class.jetpack.php:6027 0
11. check_identity_crisis C:\apache\htdocs\wordpress\wp-content\plugins\jetpack\class.jetpack-idc.php:53 0
12. __construct C:\apache\htdocs\wordpress\wp-content\plugins\jetpack\class.jetpack-idc.php:44 0
13. init C:\apache\htdocs\wordpress\wp-content\plugins\jetpack\class.jetpack-idc.php:703 0
14. require_once(C:\apache\htdocs\wordpress\wp-content\plugins\jetpack\class.jetpack-idc.php) C:\apache\htdocs\wordpress\wp-content\plugins\jetpack\load-jetpack.php:61 1
15. require_once(C:\apache\htdocs\wordpress\wp-content\plugins\jetpack\load-jetpack.php) C:\apache\htdocs\wordpress\wp-content\plugins\jetpack\jetpack.php:191 1
16. include_once(C:\apache\htdocs\wordpress\wp-content\plugins\jetpack\jetpack.php) C:\apache\htdocs\srab\wp-settings.php:362 1
17. require_once(C:\apache\htdocs\srab\wp-settings.php) C:\apache\htdocs\srab\wp-config.php:92 1
18. require_once(C:\apache\htdocs\srab\wp-config.php) C:\apache\htdocs\srab\wp-load.php:37 1
19. require_once(C:\apache\htdocs\srab\wp-load.php) C:\apache\htdocs\srab\wp-blog-header.php:13 1
20. require(C:\apache\htdocs\srab\wp-blog-header.php) C:\apache\htdocs\srab\index.php:17 1

Screenshots
If applicable, add screenshots to help explain your problem.

Workaround

Choice | Reason for not doing so
------ | ---------------------
Set WP_DEBUG false | This is a development environment. I want to see messages.
Use a local site name without a dot | Some other routines fail when the domain doesn't contain a period
Set JETPACK_DEV_DEBUG true | Well, it works but see Note 1.
Implement jetpack_development_mode filter | In this instance the filter would work if implemented by a plugin; not a theme. See Note 2.

Note 1.

I believe that the logic to check for Identity Crisis is supposed to work regardless of the value of JETPACK_DEV_DEBUG. In this case there appears to be a little timing issue.
The problem resolves itself every now and then.
I don't want to set it to true since there are 57 other checks that would now produce different results.

Note 2.

Example of a filter function that doesn't work in a Genesis child theme since it's not been added by the time the filter is first invoked.

add_filter( 'jetpack_development_mode', 'genesis_srab_jetpack_development_mode');
function genesis_srab_jetpack_development_mode( $development_mode ) {

    if ( false === $development_mode ) {
        $development_mode = defined( WP_DEBUG ) && WP_DEBUG;
    }
    return $development_mode;
}
Jetpack DNA Offline Mode [Pri] High [Type] Bug

Most helpful comment

Same issue here, on local development

All 17 comments

Could you give it another try today, with Jetpack's development version or the latest Beta available here?
https://downloads.wordpress.org/plugin/jetpack.7.5.3-beta.zip

Let us know if that helps.

Hi Jeremy. 7.5.3-beta doesn't fix the problem. The stack trace is basically the same except for
the line number on this one.

  1. require_once(C:\apache\htdocs\srab\wp-content\plugins\jetpack\load-jetpack.php) C:\apache\htdocs\srab\wp-content\plugins\jetpack\jetpack.php:194 1

PS. I installed the plugin directly, rather than via symlinking, as in the previous stack trace

I'm also still getting this error in my dev environment after installing 7.5.3 tonight.

Somewhat related: #3827

Thats a +1 for me on my staging server using a staging. subdomain:

Notice: Automattic\Jetpack\Sync\Functions was called incorrectly. Not all plugins have loaded yet but we requested the class Automattic\Jetpack\Sync\Functions Please see Debugging in WordPress for more information. (This message was added in version dev-add/jetpack-compat-package.) in /var/www/html/development/mysite/wp-includes/functions.php on line 4773

@chrisjimallen I can't seem to reproduce.

  • Do you use Jetpack 7.5.3?
  • Do you use any other plugins on that site?
  • When you go to the Jetpack dashboard, do you see the following notice?
    image

Thank you.

  • Yes, I'm running 7.5.3. Oddly, the warning seems to have gone away when I checked it today :-/
  • There are other plugins, quite a lot.
  • This is what I see now:

Screenshot 2019-07-22 at 11 50 11

I'm going to say that this is no longer an issue for me personally.

I'm experiencing a similar notice in https://github.com/rebeccahum/VIP-Jetpack-Sync-Cron-Only/issues/2 when the Jetpack functions are being called too early in my drop-in plugin. A workaround I found was to hook onto the initialization at a later hook after JP has been fully loaded.

This message keeps showing almost nonstop on local dev copy of the site, running Jetpack 7.6, on Wordpress 5.2.2 with PHP 7.0.33. I have the following constant set:
define( 'JETPACK_DEV_DEBUG', true );
The message differs slightly on my end, in the header referring to dev-update/sync-use-roles-package.
Notice: Automattic\Jetpack\Sync\Functions was called <strong>incorrectly</strong>. Not all plugins have loaded yet but we requested the class Automattic\Jetpack\Sync\Functions Please see <a href="https://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information. (This message was added in version dev-update/sync-use-roles-package.) in /wp-includes/functions.php on line 4773

Call Stack 1 | 0.0102 | 412432 | {main}( ) | .../index.php:0 2 | 0.0158 | 460120 | require_once( /wp-admin/admin.php' ) | .../index.php:10 3 | 0.0161 | 472728 | require_once( /wp-load.php' ) | .../admin.php:34 4 | 0.0163 | 475016 | require_once( /wp-config.php' ) | .../wp-load.php:37 5 | 0.0187 | 597592 | require_once( /wp-settings.php' ) | .../wp-config.php:18 6 | 0.3969 | 25418648 | include_once( /wp-content/plugins/jetpack/jetpack.php' ) | .../wp-settings.php:362 7 | 0.3984 | 25510720 | require_once( /wp-content/plugins/jetpack/load-jetpack.php' ) | .../jetpack.php:194 8 | 0.4326 | 27919480 | require_once( /wp-content/plugins/jetpack/class.jetpack-admin.php' ) | .../load-jetpack.php:68 9 | 0.4326 | 27919480 | Jetpack_Admin::init( ) | .../class.jetpack-admin.php:284 10 | 0.4326 | 27919536 | Jetpack_Admin->__construct( ) | .../class.jetpack-admin.php:23 11 | 0.4546 | 28491640 | Jetpack_React_Page->__construct( ) | .../class.jetpack-admin.php:37 12 | 0.4546 | 28492016 | Jetpack::validate_sync_error_idc_option( ) | .../class.jetpack-admin-page.php:34 13 | 0.5709 | 28806760 | Jetpack::get_sync_error_idc_option( ) | .../class.jetpack.php:6199 14 | 0.5731 | 28806592 | spl_autoload_call ( ) | .../class.jetpack.php:6258 15 | 0.5731 | 28806736 | Automattic\Jetpack\Autoloader\autoloader( ) | .../class.jetpack.php:6258 16 | 0.5734 | 28807856 | _doing_it_wrong( ) | .../autoload_packages.php:102 17 | 0.5734 | 28808624 | trigger_error ( ) | .../functions.php:4773

Also seeing this error on a staging site in conjunction with VaultPress:

component: "Plugin: vaultpress"

file: "wp-includes/functions.php"

line: 4773

message: "Automattic\Jetpack\Sync\Functions was called incorrectly. Not all plugins have loaded yet but we requested the clas…"

stack: Array (7)
0 "Automattic\J\A\autoloader()"
1 "spl_autoload_call()"
2 "Jetpack::get_sync_error_idc_option()"
3 "Jetpack::validate_sync_error_idc_option()"
4 "Jetpack::check_identity_crisis()"
5 "Jetpack_IDC->__construct()"
6 "Jetpack_IDC::init()"

Same issue here, on local development

Same issue here, on local development

Glad its not just me

Hey,

Facing this on my staging. Is this something to do with the plugin?

Is this something to do with the plugin?

We haven't been able to figure this out yet, but we'll update this issue when we do!

Yes, also seeing this issue in our logs and when turning on debugging to display in HTML.

Error message:
"Automattic\Jetpack\Sync\Functions was called <strong>incorrectly</strong>. Not all plugins have loaded yet but we requested the class Automattic\Jetpack\Sync\Functions Please see <a href="https://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information. (This message was added in version 9999999-dev.) in /......../wp-includes/functions.php on line 4778"

@kojaa If even deleting the plugin through the plugin interface is failing, that's most common due to something like incorrect server permissions or a server that is failing during the file operation. It wouldn't be a Jetpack issue.

Thanks for the reports and stack traces!

I see two paths to this bug in these reports. One path includes a call to Jetpack_IDC::init(), and that should be fixed by PR #14030. In that PR, Jetpack_IDC::init() is hooked to plugins_loaded so the PHP Notice should not be generated.

The second path goes through Jetpack_Admin::init(), and it will need a separate fix.

Was this page helpful?
0 / 5 - 0 ratings