Support » Fixing WordPress » Warning: Parameter 1 to wp_default_scripts() expected to be a reference

  • Resolved Tony Zeoli

    (@tonyzeoli)


    I can’t figure this one out. I’m getting these errors. I’ve done a few things.

    a. turned off all plugins, that did not solve the issue
    b. switched back to php 7.0 from 7.2, that didn’t solve the problem
    c. deleted all unnecessary plugins that were deactivated anyway, that didn’t solve the problem
    d. contacted the theme developer, that didn’t solve the problem as it’s not their issue
    e. switched to a WordPress theme using Health Check, that didn’t solve the problem

    Warning: Parameter 1 to wp_default_scripts() expected to be a reference, value given in /nas/content/staging/stgsborg/wp-includes/class-wp-hook.php on line 286

    Warning: Parameter 1 to wp_default_styles() expected to be a reference, value given in /nas/content/staging/stgsborg/wp-includes/class-wp-hook.php on line 286

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 25 total)
  • Moderator t-p

    (@t-p)

    What you did before this error happened?

    Tony Zeoli

    (@tonyzeoli)

    I can’t really say. Possibly upgrading to 7.2 in live, seeing the issue in live, but then regressing to 7.0, but still pushing the site into staging. So it still has the issue. It could be related to php version 7.2, but I’m not 100% sure.

    Tony Zeoli

    (@tonyzeoli)

    Wait…I just did this. I went to WP Engine, switched back to 7.0. Cleared my autoptimize cache. That fixed the error. Now I’ve set it back to 7.2 and the error disappeared.

    Ha…solved my own problem.

    Moderator t-p

    (@t-p)

    Glad to know it 🙂

    Tony Zeoli

    (@tonyzeoli)

    Ah, I found out the real issue. WP Engine has confirmed this is an error in staging for php version 7.2 they are trying to troubleshoot. They don’t have a timeline to resolution just yet, so if anyone out there is on WP Engine and seeing this, then it’s a known issue and there is a resolution sight. I’m assuming that I can work in staging with the issue present and push to live and it will disappear organically, or some I’m hoping!

    Moderator t-p

    (@t-p)

    Thanks for sharing 🙂

    mucha

    (@mucha)

    Thank you for sharing that info @tonyzeoli

    Alston

    (@visualeight)

    Added this to .htaccess and it fixed it in all my staging installs:

    php_flag display_errors off

    Moderator t-p

    (@t-p)

    side note to @visualeight,

    If you noticed this thread is marked as “resolved”!

    If you are looking for topics that could benefit from your help, try looking in https://wordpress.org/support/view/no-replies instead of piling in on this one.

    Hi @tonyzeoli

    Actually, this is happening in live environment as well.
    I’ve tested only with the Preview tool that they provided.

    reevez

    (@reevez)

    Im working with Wp Engine too.
    But with @rafawhs answer i’m not sure if this issue is solved

    svetoslavd79

    (@svetoslavd79)

    Adding the below to wp-config.php on the staging site of WpEngine worked for me:

    // Disable display of errors and warnings
    define( ‘WP_DEBUG_DISPLAY’, false );
    @ini_set( ‘display_errors’, 0 );

    Hope this helps

    mucha

    (@mucha)

    We were able to fix the errors by deleting the “&” character from the wp_default_scripts() function which is found in “/wp-includes/script-loader.php” around line 48.

    before:
    function wp_default_scripts( &$scripts ) {

    after:
    function wp_default_scripts( $scripts ) {

    Hope this helps someone.

    Alston

    (@visualeight)

    Just to add, I had to change another line in the same file referenced above by @mucha, around line 926 I had another instance of the ..( &$scripts ). So change:
    function wp_default_styles( &$styles ) {}
    becomes:
    function wp_default_styles( $styles ) {}

    This and the above fixed both errors I had after moving to PHP 7.2 on WPengine.

    bkjproductions

    (@bkjproductions)

    @visualeight are you saying you are editing core code?
    I would wonder if there is something further “upstream” in your theme’s code or a plugin’s code that is doing something. When I look up the wp_default_scripts() function it seems like this is part of the loading sequence, happens after template_redirect() but before admin_bar_init()

    http://rachievee.com/the-wordpress-hooks-firing-sequence/

Viewing 15 replies - 1 through 15 (of 25 total)
  • The topic ‘Warning: Parameter 1 to wp_default_scripts() expected to be a reference’ is closed to new replies.