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.

Installing SilverStripe /

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

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

/dev/build fails with PHP 5.4


Reply


8 Posts   3365 Views

Avatar
smares

Community Member, 25 Posts

11 March 2012 at 10:51pm

Can anyone confirm that 2.4.7's /dev/build fails with PHP 5.4. I get a notice "Array to string conversion" and backtrace tells me it's in Line 327 of Database.php: SS_Database->requireIndex(ErrorPage_versions,RecordID_Version,Array)

Avatar
martimiz

Forum Moderator, 1132 Posts

12 March 2012 at 12:31am

I read that php 5.4 no longer silently accepts array to string conversion, the idea being that it should warn against useless casting (or something of that nature)

I guess silverstripe will work when php warnings are disabled, but this should maybe be patched/looked into if version 2 is to be continued alongside 3? There might be other places where this might happen as well?

Avatar
mrProper

Community Member, 7 Posts

8 October 2012 at 7:17pm

Edited: 08/10/2012 7:17pm

Hi smares
I confirm. PHP 5.4.3
My error is in Line 162 of SSViewer.php

162       if(substr((string) $templateList,-3) == '.ss') {
163          $this->chosenTemplates['main'] = $templateList;
164       } else {
165          if(!is_array($templateList)) $templateList = array($templateList);
166          
167          if(isset($_GET['debug_request'])) Debug::message("Selecting templates from the following list: " . implode(", ", $templateList));


Do you find a clue?

Avatar
Willr

Forum Moderator, 5513 Posts

9 October 2012 at 7:46pm

Simply change

if(substr((string) $templateList,-3) == '.ss') {

to

if(is_string($templateList) && substr((string) $templateList,-3) == '.ss') {

Though not sure if 2.4 'officially' supports PHP5.4

Avatar
Sean

Forum Moderator, 922 Posts

18 October 2012 at 10:45am

This may be of some help:

https://github.com/silverstripe/sapphire/commit/4ff8cff262077e2ff1f32172cc471f829110834c

Thanks,
Sean

Avatar
socks

Community Member, 190 Posts

18 October 2012 at 12:56pm

Edited: 18/10/2012 12:57pm

Should I be having the same issue with 3.0.2 and PHP 5.3? Just get a blank white page (rest of site shows up fine)

Not sure if it's related but the installation gives the false mod_rewrite and AllowOverride All issues with Friendly URLs.
[url]http://open.silverstripe.org/ticket/7498[/url]

Thanks

Avatar
a1abhishek

Community Member, 1 Post

27 October 2012 at 7:13am

we have the same problem occurring again n again.

Avatar
socks

Community Member, 190 Posts

27 October 2012 at 12:56pm

Edited: 27/10/2012 12:56pm

I upgraded from 3.0.2 to the daily build and that fixed the dev/build issues.