Jump to:

1131 Posts in 1965 Topics by 402 members

Upgrading SilverStripe

SilverStripe Forums » Upgrading SilverStripe » Issues With SilverStripe 3

Ask questions about upgrading SilverStripe to the latest version.

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

Page: 1 2
Go to End
Author Topic: 1727 Views
  • Liam
    Avatar
    Community Member
    470 Posts

    Issues With SilverStripe 3 Link to this post

    1. Fixed this issue. 2nd issue below still happens on some installs.

    2. This issue just started with RC1. It never appeared when I was using beta versions of 3. I can't load any admin link with ajax. Throws an error and just hangs. I have to do a hard refresh for the page to load.

    Screenshot of error message:

    http://shiftideas.com/stuff/ss-error2.png

  • nikrolls
    Avatar
    Community Member
    8 Posts

    Re: Issues With SilverStripe 3 Link to this post

    I was having the same symptoms as #2 with both RC1 and RC2 (though I never saw the error you posted). I narrowed it down to the fact that since the RC, CMS Ajax calls return JSON rather than plain HTML.

    Something was causing "\r\n" to be output before the JSON code but after the Content-Length is already calculated, and this meant that the last two characters of the JSON output were truncated (the important "} ) meaning that the eval() fails and the .success callback was never executed.

    Over around four hours I narrowed it down to coming from /cms/code/controllers/CMSMain.php, generatePageIconsCss() (of all places), in the $obj = singleton($class) line (around line 412). This loops through all the classes available, and through some trial and error I found that one of my classes in /mysite/code had a blank line before the opening <?php tag.

    Note that this wasn't an issue in the beta -- it only showed up in RC -- so you may have one of these stray lines that you didn' t know about. I'd recommend using Firebug to check the result of the CMS's XHRs and see if there's a blank line before the JSON output.

    Perhaps Core::singleton() (or one of the methods it uses to get the class) could be tweaked to make it a little more foolproof?

  • Liam
    Avatar
    Community Member
    470 Posts

    Re: Issues With SilverStripe 3 Link to this post

    I've figured out my first issue. It was code in a custom page class.

    Is there a ticket open for the 2nd issue you found?

    On a fresh install of rc2 I had no issues even with all my custom page types, but that's all I uploaded. No template stuff or any other files.

    On my old install of rc2 I'm still getting the 2nd error with the admin pages not loading with ajax. None of my classes in mysite/code have an empty space before the opening php tag. I'll have to do some more narrowing down to see what is causing it.

  • nikrolls
    Avatar
    Community Member
    8 Posts

    Re: Issues With SilverStripe 3 Link to this post

    I didn't submit a ticket for this one because it was actually an issue with out code (though in a perfect world Silverstripe would correct something like this).

    Have you tried monitoring the CMS Ajax calls I'm Firebug? You could check the result in a parser like json.parser.online.fr to make sure it is valid.

  • Liam
    Avatar
    Community Member
    470 Posts

    Re: Issues With SilverStripe 3 Link to this post

    I opened a ticket for it as I think it needs to be addressed.

    http://open.silverstripe.org/ticket/7574

    If you want to add any comments in it, that would help. I'm a designer, not a developer so you'd be of more use.

    I'm going to copy and paste your detailed response in there.

    I use Chrome and used their XHR tab in the debugger and can't find much. I'll do more tonight and see.

  • nikrolls
    Avatar
    Community Member
    8 Posts

    Re: Issues With SilverStripe 3 Link to this post

    Are you able to test this in Firefox? Then we can tell if our issues are similar, and then if so I can post on the ticket.

    Firefox -> Firebug -> monitor the XHR request in there -> Copy/paste the result to json.online.parser.fr -> Check validity of the code.

    In my case the last few characters were being truncated, causing the JSON to be invalid.

  • Liam
    Avatar
    Community Member
    470 Posts

    Re: Issues With SilverStripe 3 Link to this post

    Okay I checked in FireBug and right clicked, copy content as json and ran the script in the site you linked and got 1 error.

    I have the output here to confirm I did this right as I'm not sure.

    http://shiftideas.com/stuff/ss-json.txt

  • nikrolls
    Avatar
    Community Member
    8 Posts

    Re: Issues With SilverStripe 3 Link to this post

    Pretty much -- I've attached my output so you can see what I mean.

    In my case there was an extra line before {"Content", and the output ended with </div> when it should have been </div"} to be valid JSON.

    In my attached picture you can see there is a JSON tab in the response -- this only shows up if the response is valid JSON. If you're having the issue I did then you'll only get Headers and Response tabs.

    Hope that helps!

    Attached Files
    1727 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.