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   3141 Views

Avatar
smares

11 March 2012 at 10:51pm Community Member, 25 Posts

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

12 March 2012 at 12:31am Forum Moderator, 1095 Posts

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

8 October 2012 at 7:17pm (Last edited: 8 October 2012 7:17pm), Community Member, 7 Posts

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

9 October 2012 at 7:46pm Forum Moderator, 5511 Posts

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

18 October 2012 at 10:45am Forum Moderator, 921 Posts

This may be of some help:

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

Thanks,
Sean

Avatar
socks

18 October 2012 at 12:56pm (Last edited: 18 October 2012 12:57pm), Community Member, 190 Posts

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

27 October 2012 at 7:13am Community Member, 1 Post

we have the same problem occurring again n again.

Avatar
socks

27 October 2012 at 12:56pm (Last edited: 27 October 2012 12:56pm), Community Member, 190 Posts

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