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 | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Script Loader | Keywords: | |
Focuses: | Cc: |
Description
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)
#3
@
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
@
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
@
5 years ago
- The warning message shows up on the admin dashboard page.
- Yes, it appears when the page is loading also.
- We are using PHP 7.3
- 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.
- And yes I turned off all plugins and even themes and still, the warning showed up on the same page.
#7
@
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: https://gist.github.com/jrfnl/5925642
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
@
5 years ago
@jrf
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
@
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.
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?