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.

Upgrading SilverStripe /

Ask questions about upgrading SilverStripe to the latest version.

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

Issues With SilverStripe 3


Go to End


12 Posts   4702 Views

Avatar
Liam

Community Member, 470 Posts

19 June 2012 at 7:16am

Edited: 27/06/2012 6:58am

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

Avatar
nikrolls

Community Member, 8 Posts

25 June 2012 at 6:27pm

Edited: 25/06/2012 6:29pm

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?

Avatar
Liam

Community Member, 470 Posts

27 June 2012 at 6:57am

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.

Avatar
nikrolls

Community Member, 8 Posts

27 June 2012 at 12:35pm

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.

Avatar
Liam

Community Member, 470 Posts

28 June 2012 at 6:52am

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.

Avatar
nikrolls

Community Member, 8 Posts

28 June 2012 at 12:20pm

Edited: 28/06/2012 12:20pm

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.

Avatar
Liam

Community Member, 470 Posts

28 June 2012 at 12:38pm

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

Avatar
nikrolls

Community Member, 8 Posts

28 June 2012 at 1:05pm

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
Go to Top