Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

GPM error: Invalid argument supplied for foreach()

Started by Muut Archive 11 years ago · 9 replies · 650 views
11 years ago

Hello,

I'd like to ask for assiatance with the followig error:

--------```
$ bin/gpm install mediator

[Whoops\Exception\ErrorException]
Invalid argument supplied for foreach()
--------```

At first, when trying to install the theme, I got the error:

-------- [RuntimeException] Error while trying to download 'https://github.com/getgrav/grav-theme-mediator/zipball/1.0.3' --------

I got rid off this error by creating directory /home/username/.grav/config, which was mentioned in yet another error below that I fixed with php.ini edit:

-------- [Whoops\Exception\ErrorException] file_exists(): open_basedir restriction in effect. --------

Would you please advise how to get through the "Invalid argument supplied for foreach()" error ?

Thank you!

11 years ago

Ok, I just tested and it works fine on my local. So it's not the mediator theme specifically:

YAML
~/workspace/grav 3 $ bin/gpm install mediator

Please select installation method for Mediator (GPM is default)
  [0] GPM
  [1] Symlink
 > 0

Preparing to install Mediator [v1.0.3]
  |- Downloading package...   100%
  |- Checking destination...  ok
  |- Installing package...    ok
  '- Success!

Clearing cache

Cleared:  cache/compiled/*

Touched: /Users/rhuk/workspace/grav 3/user/config/system.yaml

By default, GPM expects to use github tarballs to install. The option to install by symlink is for development only. You creating a .grav/config file is what triggers the symlink option, and unless you have that setup 100% correct, will cause that error you are seeing.

The fundamental problem is that you are unable to access those tarballs. So:

1) Delete your .grav/config file, that is only causing more problems
2) Ensure you have all the Grav PHP pre-requisites.

Most likely you are missing Curl or OpenSSL setup with your PHP install. You can run:

BASH
$ php -i

and put that output in a gist or some other readable text file, and we can examine that to see what you have installed and what's missing.

11 years ago

Nothing jumps out at me there. Assuming you have now removed the .grav/config file, what happens when you do a bin/gpm index ? What about bin/gpm install mediator ?

11 years ago

I have removed ".grav/config" and running "bin/gpm index" gives me a list of plugins and themes, no errors.

When running "bin/gpm install mediator" I get the following error:
--------```
$ bin/gpm install mediator

Preparing to install Mediator [v1.0.3]
|- Downloading package... 0%

[RuntimeException]
Error while trying to download 'https://github.com/getgrav/grav-theme-mediator/zipball/1.0.3'

install [-f|--force] [-y|--all-yes] [-d|--destination [DESTINATION]] [--] <package> (<package>)...

11 years ago

Instead of running the PHP that was built by me from source, I have switched to the PHP provided by my host and now the error does not appear.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1330 9 years ago
Archive · by Muut Archive, 9 years ago
2 922 9 years ago
Archive · by Muut Archive, 9 years ago
2 4052 9 years ago
Archive · by Muut Archive, 9 years ago
1 2930 9 years ago
Archive · by Muut Archive, 9 years ago
3 1109 9 years ago