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

Error: E_WARNING - trim() expects parameter 1 to be string, array given

Started by Muut Archive 10 years ago · 5 replies · 644 views
10 years ago

hello all!

i'm having a problem in getting my local files to work on the server. each time i try to access the online version (or the admin panel) i get same error: "E_WARNING - trim() expects parameter 1 to be string, array given".

it doesn't matter if the files are cloned via github, or zipped and uploaded via sftp. i tried to look up the error message in logs/ but i have no idea where to start debugging, since i don't use the trim() command in my templates...

my server is running php 7.0.2 and i had a working site before (albeit with grav 1.0.8). so maybe the update is due to me upgrading locally to grav 1.0.9?

thanks a million for your feedback!

10 years ago

Is it possible to zip up your site and PM me a link to download it and try it. I need to see if it's a config thing or a server thing.

10 years ago

Ok works for me too. Must be a server thing. Do you get any line number on that error? Perhaps turn on the displaying of detailed errors in the system.yaml?

YAML
errors:
  display: true  

Or check the logs/grav.log for more information?

10 years ago

ah! thanks to your hints i think i found the problem. i was trying to set two different home-routes in system.yaml
home:
alias:
en: '/welcome'
fr: ' /bienvenue'
apparently this produced the problem, as it turned the home-string into an array. now that i changed it to
home:
alias: '/welcome'
it works perfectly.

10 years ago

but, how would i go on about, setting two different routes for different language versions?

10 years ago

ok, to wrap this up i'm going to copy paste rhuksters solution into this thread:

"I think i found the problem - try changing this in your user/config/system.yaml
home:
alias:
en: /welcome
fr: /bienvenue
to:
home:
aliases:
en: /welcome
fr: /bienvenue

note the aliasES
That should resolve it."

... and it did :-) thank you!

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1356 9 years ago
Archive · by Muut Archive, 9 years ago
2 936 9 years ago
Archive · by Muut Archive, 9 years ago
2 4066 9 years ago
Archive · by Muut Archive, 9 years ago
1 2954 9 years ago
Archive · by Muut Archive, 9 years ago
3 1120 9 years ago