Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Installing SilverStripe /

Getting SilverStripe up and running on your computer and on your web server.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Installing 2.4 - Array to string conversion


Go to End


12 Posts   10636 Views

Avatar
thepurpleblob

Community Member, 28 Posts

26 February 2013 at 12:10am

I am attempting to install a 2.4 site - the latest from Git topped up with Composer. I am running PHP 5.4.6

When trying to build the database it fails with the following message...

[Notice] Array to string conversion
POST /silver/install.php

Line 396 in /var/www/silver/sapphire/core/model/Database.php

I have read a few posts about such issues in 2.4 and PHP 5.4.6 but couldn't find anything related to installing it in the first place. I'm stuck with 2.4 for the moment by the way.

Any help appreciated.

Avatar
dhensby

Community Member, 253 Posts

26 February 2013 at 8:31pm

Are you using a _ss_environment.php file?

Are you using a global called $database in your config?

Have you defined $databaseConfig array in your config?

It sounds like one of the database details that should be a strong is set to an array instead.

Avatar
Willr

Forum Moderator, 5523 Posts

28 February 2013 at 9:13pm

SilverStripe 2.4 (early versions) do not support PHP5.4 out of the box (before it existed!) so try the post-2.4 branch from git for support. The latest 2.4.* release should also support it.

Avatar
Optic Blaze

Community Member, 190 Posts

12 March 2013 at 6:16am

Hi there,

I just installed a fresh copy of SS 2.4.10 and i also get the 'Array to string conversion' error...see below. The server runs PHP 5.4.4:

[Notice] Array to string conversion
GET /sunnyecom/admin/

Line 386 in ...../sapphire/core/control/Controller.php
Source

377 /**
378 * Returns true if the member is allowed to do the given action.
379 * @param perm The permission to be checked, such as 'View'.
380 * @param member The member whose permissions need checking. Defaults to the currently logged
381 * in user.
382 * @return boolean
383 */
384 function can($perm, $member = null) {
385 if(!$member) $member = Member::currentUser();
386 if($this->hasMethod($methodName = 'can' . $perm)) {
387 return $this->$methodName($member);
388 } else {
389 return true;
390 }
391 }
392

Avatar
thepurpleblob

Community Member, 28 Posts

12 March 2013 at 7:26am

Sorry for the delay - this site hates me and I couldn't get logged back in.

I was using the latest version from the Git repository all along so no progress there. In the end, I didn't have a huge amount to do so I just installed it on one of our servers running PHP 5.3. Got the job done in terminal mode and Vim - just like the good old days ;-)

Thanks anyway for the help !!

Avatar
Tama

Community Member, 138 Posts

23 April 2013 at 3:03pm

Does anyone have a fix for this?

I've got an existing 2.4 website I'm trying to work on in my local environment (latest version of XAMMP). I've upgraded it to 2.4.10 but am still getting this error when I try to logon to the admin area:

[Notice] Array to string conversion
GET /admin

Line 386 in C:\xampp\htdocs\heart-of-biking\sapphire\core\control\Controller.php

384 	function can($perm, $member = null) {
385 		if(!$member) $member = Member::currentUser();
386 		if($this->hasMethod($methodName = 'can' . $perm)) {
387 			return $this->$methodName($member);
388 		} else {
389 			return true;
390 		}
391 	}

I don't want to downgrade the PHP version in my local environment, is there any other way to fix this?

Avatar
Willr

Forum Moderator, 5523 Posts

23 April 2013 at 3:57pm

Download the post-2.4 branch from github. You can patch that file also if you need http://open.silverstripe.org/ticket/7737

Avatar
Tama

Community Member, 138 Posts

23 April 2013 at 4:14pm

Thanks Will.

I added the following to line 386 on Controller.php

if(is_string($perm) && $this->hasMethod($methodName = 'can' . $perm)) {

Seems to work.

Go to Top