Invalid argument supplied for foreach() error found in helpers/BaseArrayHelper.php when using yii2 php5 apache - php-5.6

I got problem Invalid argument supplied for foreach() in /home/vagrant/www/.../vendor/yiisoft/yii2/helpers/BaseArrayHelper.php on line 121 when want to surf my local by using apache as my server. All environment have been set up in vagrant with using php5.5.9.
Thanks in advance for helping.

Return empty array in config files which are empty.
suppose your params-local.php have only opening php tag then
Replace
with
<?php
return [
];

Related

Can't export database from phpMyadmin on Xampp

I tried to export a WordPress database from Xampp's phpMyAdmin, but suddenly this error shows up:
Fatal error: Uncaught TypeError: Argument 5 passed to PhpMyAdmin\Export::getFilenameAndMimetype() must be of the type string, null given, called in C:\xampp\phpMyAdmin\export.php on line 380 and defined in C:\xampp\phpMyAdmin\libraries\classes\Export.php:270 Stack trace: #0 C:\xampp\phpMyAdmin\export.php(380): PhpMyAdmin\Export->getFilenameAndMimetype('database', '', Object(PhpMyAdmin\Plugins\Export\ExportSql), '', NULL) #1 {main} thrown in C:\xampp\phpMyAdmin\libraries\classes\Export.php on line 270
I tried cleaning the cache from the dev tools of the browser, but the issue hasn't been solved. Besides, as soon as I click on "Export", I see a message about one form having more than 1000 lines.
I successfully exported the database with the command line, following another solution found here at StackOverflow, but I need to deselect a couple of tables, which is why I'd rather use the "usual" way.
Thank you very much in advance!
This is what, in my case, solved the issue.
Open the Xampp's php.ini file and paste the following at the bottom:
max_input_vars = 5000
suhosin.request.max_vars = 5000
suhosin.post.max_vars = 5000
Save the file and restart Apache from Xampp.
This is what worked for me when I was exporting a table,
While you export you will find Quick is selected,
you need to select custom, then
go to Output section and do the following
select, save output to file
on compression category, select zipped
Then go on download your table as a zipped file.

How from my envoy script to write app version to database?

With laravel 5.8 envoy command I deploy my changes and I need from my envoy script to write app version to database
For this I created console command , which is located in app/Console/Commands/envoyWriteAppVersion.php file,
but I did not find how to assign additive parameter to my consol commad. I tried like :
php artisan envoy:write-app-version "654"
php artisan envoy:write-app-version 654
php artisan envoy:write-app-version app_version=7.654
But I got error :
Too many arguments, expected arguments "command".
This task did not complete successfully on one of your servers
Which is the valid way ?
Thanks!
I found a valid decision to use in my console command method :
$arguments = $this->arguments();
as it is written here https://laravel.com/docs/5.8/artisan#command-io.
and run from console with space :
php artisan envoy:write-app-version 0.101

How can I set a Heroku config var to a JSON value?

I want to use a JSON value as a environment variable with heroku config:set.
But if I run this command:
heroku config:set FOO_JSON={"abc":"bcd","cde":"def" ... }
all " are removed like this:
FOO_JSON={abc:bcd,cde:def ... }
and I get a parse error.
How can I use JSON in Heroku's environment variables?
Heroku will remove the first and last " but that is fine, I had similar issue recently.
When you fetch the variable in your codebase, it will be wrapped with string quotations back so you can successfully JSON.parse(process.env.VARIABLE)
Example. I had a list of some banned users in my local .env
BANLIST = '["abdu","yak","jek","tosch","krek"]'
So, I can simply set
heroku config:set BANLIST='["abdu","yak","jek","tosch","krek"]'
or
heroku config:set BANLIST=["abdu","yak","jek","tosch","krek"]
Both of them will result to ["abdu","yak","jek","tosch","krek"].
So, when you fetch it back with JSON.parse(process.env.BANLIST), you will get the appropriate array output.
Warning: If you set the config variable wrapped with ' or " with heroku GUI interface, it will not set at all, so just put your array or object JSON without wrapping it with either of those
This is because of how your shell processes quotes. Wrap the whole thing in single quotes:
heroku config:set FOO_JSON='{"abc":"bcd","cde":"def" ... }'

Error when starting Yesod app on openshift - command line args?

I am getting the following error when (re)starting my Yesod app on openshift:
server: InvalidYaml (Just (YamlException "Yaml file not found: xxx.xxx.xxx.xxx"))
Where xxx.xxx.xxx.xxx is an IP address. I did find a link to a Heroku+Yesod issue saying something about "removing an argument" but it didn't say from where, and of course the scripts/settings are going to be different in the case of OpenShift. Any ideas what this error is and how to get past it?
I'm assuming based on the question that you're using the standard scaffolding. If you look in the code, you'll find that uses loadAppSettingsArgs, which is described as:
Same as loadAppSettings, but get the list of runtime config files from the command line arguments.
If you don't want to pay attention to command line arguments, just replace the call to loadAppSettingsArgs with loadAppSettings [].

redis.conf include: "Bad directive or wrong number of arguments"

I've created this config for redis [/etc/redis/map.conf]:
include /etc/redis/ideal.conf
port 11235
pidfile /var/run/redis-map.pid
logfile /var/log/redis/map.log
dbfilename map.rdb
As you can see, it includes /etc/redis/ideal.conf; this file actually exists and we have read permissions.
Also there is another file, slightly different; consider [/etc/redis/storage.conf]:
include /etc/redis/ideal.conf
pidfile /var/run/redis-storage.pid
port 8000
bind 192.168.0.3
logfile /var/log/redis/storage.log
dbfilename dump_storage.rdb
My problem is: I can launch redis-server with storage.conf (and everything works fine), but map.conf leads to the following error:
Reading the configuration file, at line 1
>>> 'include /etc/redis/ideal.conf'
Bad directive or wrong number of arguments
failed
Version of redis is 2.2.
Where did I go wrong?
Sorry guys.
I was using different instances of Redis.
Instance for storage.conf was launched by /usr/local/bin/redis-server, but map.conf launched by /usr/bin/redis-server; second one is broken.
Thank you anyway.