PHP Fatal error: Cannot redeclare dump()

Was going to install a plugin with kirby plugin:install author/name and got the following error

PHP Fatal error:  Cannot redeclare dump() (previously declared in /Users/xx/.composer/vendor/symfony/var-dumper/Resources/functions/dump.php:18) in /Users/xx/website/kirby/vendor/getkirby/toolkit/helpers.php on line 114

The only thing that could have messed things up is that I installed valet with composer some days ago, but I am not using it for this website.

If I do kirby update I get the same error as well.

Ideas?

Have you recently installed anything? Like Laravel Valet maybe?

Yes, I said that (maybe should have been more explicit).

Sorry, I overlooked that. I’m actually getting the same error since having installed Valet. Haven’t had a chance to look into this.

The functions conflict because they are not namespaced or prefixed, and since they all live in the same bucket, well, they collide.

I think I’m gonna take it off for now… Thanks for pointing it out!

For anyone needing this — https://stackoverflow.com/a/40279538

(I replaced brew uninstall php70 w/ brew uninstall php72)

Does it still happen if you stop Valet running temporarily? Does it really need complete removal?

You can stop its daemon from running with valet stop, and then restart it with valet restart.

My thinking is if its not running, its not using those conflicting functions.

I don‘t have it running but the problem exists nevertheless.

Hmm thats a shame. Worth a shot though.

@afincato If we don’t install the CLI globally but into its own separate folder and include the path in the $PATH variable (like I actually had it on my last Mac), we shouldn’t run into this conflict. See the CLI readme.

Edit: Just to let you know, I installed the CLI to another path, added the path to the $PATH variable and can now run both the CLI and Laravel Valet happily together.

this is smart, indeed. did you try?

might give it a try in the coming days and will report back!

Yep, up till now it’s running without any problems. Make sure to close your terminal windows to pick up the changes.

i’m giving this a go! on macOS, which custom folder did you choose to install kirby cli?

re: one of those .dotfolder?

Just a standard folder in my user folder, in this case it is stupidly called vendor, but could be renamed to anything more useful like kirby_cli or whatever you like.

sorry to come back to this only now.

having problems with… setting up the correct path to the local folder of kirby-cli on my .bashrc.

this is all i have (that i am aware of), composer-related:

# --- composer
export PATH=$HOME/.composer/vendor/bin:$PATH
export PATH=$HOME/kirby-cli/vendor/bin:$PATH
export PATH=/Users/af-etc/.pyenv/shims:/Users/af-etc/.composer/vendor/bin:/Users/af-etc/.nvm/versions/node/v8.7.0/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/opt/fzf/bin:/usr/local/opt/go/libexec/bin:~/.local/bin
export PATH="/usr/local/sbin:$PATH"

the second line, which should link to the local package of kirby, it’s not working (i reloaded / quitted-repoened the terminal).

what’s a way to set it up correctly?

In my case it looks like this:

alias composer="php /usr/local/bin/composer.phar"
export PATH=$PATH:~/.composer/vendor/bin
export PATH=$PATH:~/vendor/bin #this is where the cli lives

thank you. i updated it to

alias composer="php /usr/local/bin/composer"
export PATH=$PATH:~/.composer/vendor/bin
export PATH=$PATH:~/kirbycli/vendor/bin

adding /vendor between my kirbycli folder and the bin folder, as that’s how structured the folder.

composer and valet commands work perfectly, kirby still not.

Really? In my structure, it looks like this:

13

This is the vendor folder I’m referring to in my path.

oh wait, i’m getting confused now.

24

Well, maybe your vendor folder is inside a kirbycli folder, I don’t know…

Also having same problem. I would rather not make another composer folder. Isn’t it just matter of updating kirby-cli somehow?