Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#48205 closed defect (bug) (invalid)

Warning: Cannot use a scalar value as an array

Reported by: radevwp's profile radevwp Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Script Loader Keywords:
Focuses: Cc:


Warning: Cannot use a scalar value as an array in /nas/content/staging/nuestravision/wp-includes/class.wp-scripts.php on line 454

I have already deactivated the theme and plugins and reactivated one by one with no successful results.

Change History (9)

#1 @pbiron
5 years ago

Hi @radevwp, welcome to Trac! Thanx for the ticket.

Can you please provide a little more information? For starters, what are you doing when you get this error? Are you in the back-end or the front-end? If on the back-end, what screen are you on?

#2 @desrosj
5 years ago

  • Keywords reporter-feedback added

#3 @radevwp
5 years ago

hello and thank you for responding. I am using wpengine and we have a multisite. But the issue is only showing up on our staging website. The warning just shows up on top of the admin dashboard backend.

#4 @desrosj
5 years ago

Thanks for the additional details, @radevwp. However, it's still not enough information to try and reproduce to debug. Can you answer these questions?

  • What pages does it appear on in the admin? Every page? Specific ones?
  • Does it appear when the page loads? Or when you do something specific?
  • Which version of PHP are you using?
  • Is your production site using the exact same set of plugins as staging? Same WordPress version?
  • Have you disabled all of your plugins to see if this persists?

#5 @radevwp
5 years ago

  1. The warning message shows up on the admin dashboard page.
  1. Yes, it appears when the page is loading also.
  1. We are using PHP 7.3
  1. Yes, the production site is the same as the staging site. we push to staging at least once a week and this warning message has been around for at most 2 or 3.
  1. And yes I turned off all plugins and even themes and still, the warning showed up on the same page.
Last edited 5 years ago by radevwp (previous) (diff)

#6 @SergeyBiryukov
5 years ago

  • Component changed from General to Script Loader

#7 @jrf
5 years ago

@radevwp I've had a quick look at the code in question, but the only way this could happen is if the localize() function was called with $l10n set to a scalar value instead of an array.

To figure out where that function call is made from, a debug backtrace is needed.

Could you please provide that ?

If you don't know how to get a debug backtrace of the error, have a look here at some code you can inject into the wp-config.php file on your staging server to generate it:

As a side-note: yes, the function could be coded slightly more defensively, but finding out where this is coming from is the more important issue.

#8 @radevwp
5 years ago


Here is the result of the backtrace.

[15-Oct-2019 15:07:33 UTC] Backtrace from warning 'Cannot use a scalar value as an array' at /nas/content/staging/nuestravision/wp-includes/class.wp-scripts.php 454: /nas/content/staging/nuestravision/wp-includes/functions.wp-scripts.php 200 calling localize() | /nas/content/staging/nuestravision/wp-content/mu-plugins/wpengine-common/class-gutenberg-onboarding.php 165 calling wp_localize_script() | <unknown file> <unknown line> calling action_admin_enqueue_scripts() | /nas/content/staging/nuestravision/wp-includes/class-wp-hook.php 286 calling call_user_func_array() | /nas/content/staging/nuestravision/wp-includes/class-wp-hook.php 310 calling apply_filters() | /nas/content/staging/nuestravision/wp-includes/plugin.php 465 calling do_action() | /nas/content/staging/nuestravision/wp-admin/admin-header.php 104 calling do_action() | /nas/content/staging/nuestravision/wp-admin/index.php 111 calling include()

#9 @desrosj
5 years ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
  • Version 5.2.3 deleted

Thanks for sharing this, @radevwp!

From the stack trace you have provided, it looks like the issue may be coming from the mu-plugins folder. More specifically, wpengine-common/class-gutenberg-onboarding.php.

Please open a support request with your hosting provider for this one.

Note: See TracTickets for help on using tickets.