php cannot use a scalar value as an array
Cannot use a scalar value as an array while using PDO [duplicate]
I am trying to input data from a JSON API into a MySQL DB but I have an error.
Warning: Cannot use a scalar value as an array in C:\xampp\htdocs\simplehtmldom\example\scraping\example_scraping_imdb.php on line 8
Warning: Cannot use a scalar value as an array in C:\xampp\htdocs\simplehtmldom\example\scraping\example_scraping_imdb.php on line 9
Warning: Cannot use a scalar value as an array in C:\xampp\htdocs\simplehtmldom\example\scraping\example_scraping_imdb.php on line 10
Warning: Cannot use a scalar value as an array in C:\xampp\htdocs\simplehtmldom\example\scraping\example_scraping_imdb.php on line 11
Warning: Cannot use a scalar value as an array in C:\xampp\htdocs\simplehtmldom\example\scraping\example_scraping_imdb.php on line 12
Warning: Cannot use a scalar value as an array in C:\xampp\htdocs\simplehtmldom\example\scraping\example_scraping_imdb.php on line 13
Warning: Cannot use a scalar value as an array in C:\xampp\htdocs\simplehtmldom\example\scraping\example_scraping_imdb.php on line 14
Warning: Cannot use a scalar value as an array in C:\xampp\htdocs\simplehtmldom\example\scraping\example_scraping_imdb.php on line 15
Al those lines are the bind param statements in the PHP code.
Here is the code that I use (The JSON objects are nested):
EDIT: Sample of JSON data:
Hope someone has a sollution. Thanks in advance.
Cannot use a scalar value as an array when first opening phpmyadmin from xamp
I’ve seen previously asked problems concerning with this title. but my case is little bit different. I am getting this error when I first try to open localhost/phpmyadmin. it lists bunch of errors saying «Cannot use a scalar value as an array».
here are the errors
it is not only this. but it is too many such like errors are appearing till the end of the scroll. I am afraid of not to loose my databases. Can any one tell me what mistake do I made and how to solve it please?
4 Answers 4
I have tried hard reload but no luck but then i have done the task As Displayed in above image then phpmyAdmin is running as it should be.
So to do it first of all press F12 on your browser to open developer tool.
And go to Application tab then on the Left side-bar go to Clear Storage as in image redlined and numbered 1
And now the chart will appear for storage data and at exactly below it there will be Clear Site data button as in image redlined and numbered 2 Just Press that button and refresh the phpmyAdmin Tab it will definitely working now.
PHP Warning: Cannot use a scalar value as an array in DataObject.inc.php on line 133 #2772
Comments
hekutoru2kx commented Sep 7, 2017 •
We recently updated from 2.4.8.2 to 3.0.2. We are a multi journal site (with some multilingual journals) and we are experiencing some functionality issues due to a warning php error. Our database is a postgres database.
There a two actions that can’t be make specifically:
Both of this actions are showing the error (This error also appears in other parts of the site but so far doesn’t affected the way it works)
PHP Warning: Cannot use a scalar value as an array in /var/www/html/revista/lib/pkp/classes/core/DataObject.inc.php on line 133, referer: http://revistas.uis.edu.co/xxxxxx
This is the log error (without debugging option active):
[Thu Sep 07 01:28:26.458290 2017] [:error] [pid 22092] [client 181.33.70.56:12869] PHP Notice: Undefined offset: 0 in /var/www/html/revista/lib/pkp/lib/adodb/drivers/adodb-postgres7.inc.php on line 222, referer: http://revistas.uis.edu.co/index.php/revistaprueba/submissions [Thu Sep 07 01:28:27.161496 2017] [:error] [pid 22092] [client 181.33.70.56:12869] PHP Warning: Cannot use a scalar value as an array in /var/www/html/revista/lib/pkp/classes/core/DataObject.inc.php on line 133, referer: http://revistas.uis.edu.co/index.php/revistaprueba/submissions [Thu Sep 07 01:37:46.290907 2017] [:error] [pid 22511] [client 181.33.70.56:13040] PHP Warning: Cannot use a scalar value as an array in /var/www/html/revista/lib/pkp/classes/core/DataObject.inc.php on line 133, referer: http://revistas.uis.edu.co/index.php/revistaprueba/manageIssues [Thu Sep 07 01:37:46.290999 2017] [:error] [pid 22511] [client 181.33.70.56:13040] PHP Warning: Cannot use a scalar value as an array in /var/www/html/revista/lib/pkp/classes/core/DataObject.inc.php on line 133, referer: http://revistas.uis.edu.co/index.php/revistaprueba/manageIssues
The closest related issue that I could find in the forum is this #1336 but I couldn’t understand the fix (delete the offending no-locale settings from issue_settings).
Thanks for the good work
The text was updated successfully, but these errors were encountered:
WordPress.org
Support » Fixing WordPress » Warning: Cannot use a scalar value as an array
Warning: Cannot use a scalar value as an array
On a server with php 7.2 and WP 5.0.3, i got this warning in my wp-admin.
Warning: Cannot use a scalar value as an array in /wp-includes/class.wp-scripts.php on line 445
When i check the code at line indicated, there is a if checking if the value is not a scalar.
Looking for a solution, i found this on php manual : http://php.net/manual/en/language.types.array.php
For any of the types integer, float, string, boolean and resource, converting a value to an array results in an array with a single element with index zero and the value of the scalar which was converted. In other words, (array)$scalarValue is exactly the same as array($scalarValue).
But it does seem like an edge case, where the parameter is cast to an array for the loop, but not converted to an array as the code actually expects.
Forum Moderator & Support Team Volunteer
This may be a plugin or theme conflict. Please attempt to disable all plugins, and use one of the default (Twenty*) themes. If the problem goes away, enable them one by one to identify the source of your troubles.
If you can install plugins, install “Health Check”: https://wordpress.org/plugins/health-check/ On the troubleshooting tab, you can click the button to disable all plugins and change the theme for you, while you’re still logged in, without affecting normal visitors to your site. You can then use its admin bar menu to turn on/off plugins and themes one at a time.
I asked about it in today’s core dev chat, and the release lead says it looks like a bug. So, would you like to write up the ticket for it?
https://core.trac.wordpress.org/
First i’d like to thank you for your answers.
Asap i’ll install health check and follow your advice.
concerning the ticket it’ll be my very first one, but i’ll try to do it also asap.