Page 1 of 1

Ajax problem due to the empty line in the beginning of the page output

Posted: Mon Dec 27, 2010 12:28 pm
by Sonya
When I see the HTML source of my page I can see an empty line at the beginning of the HTML source:

Code: Select all

1: 
2: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3: <__html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
This causes Ajax error in the admin panel. Whenever I click on Collapse all Sections or Expand All Sections in the content list (Content ยป Pages) I get an error with Firebug:
XML Parsing Error: XML or text declaration not at start of entity
Location: http://xxxxx/admin/listcontent.php?sp_=ed0f1b93
Line Number 2, Column 1:
CMSMS version 1.9.2.

I have some installations that do have an empty line in output and some that not. Trying to figure out the difference between them, I noticed that there is no empty line after the fresh install. When I install the modules Polls and AjaxMadeSimple the empty line appears and it DOES NOT disappear even if the both modules are uninstalled and completely removed.

Additionally, I have figured out that lines are added somewhere BEFORE

Code: Select all

echo $html;
So that trimming output at this place does not take any effect.

Can someone reproduce the issue?

EDIT: Further debugging shows that empty line is added after the line

Code: Select all

$modload->LoadModules(isset($LOAD_ALL_MODULES), !isset($CMS_ADMIN_PAGE));
in include.php

Re: Ajax problem due to the empty line in the beginning of the page output

Posted: Mon Dec 27, 2010 12:55 pm
by RonnyK
Sonya,

I am not seeing the blank line in my source of latest... Does your template have the logic at the first line, or is there a blank there already?

Make sure that the page-template starts like...
{process_pagedata}
and NOT like:

{process_pagedata}
Ronny

Re: Ajax problem due to the empty line in the beginning of t

Posted: Mon Dec 27, 2010 1:07 pm
by Sonya
RonnyK wrote: Does your template have the logic at the first line, or is there a blank there already?
Yes, it does solve a problem temporary.

I guess that empty line is added somewhere in the include.php before the template is parsed. I have made further debugging and am now in the class.moduleloader.php. It seems that the line is produced in LoadModules(), somewhere in the

Code: Select all

while ($result && !$result->EOF)

Re: Ajax problem due to the empty line in the beginning of t

Posted: Mon Dec 27, 2010 8:38 pm
by Sonya
This strange behavior has been already submitted http://dev.cmsmadesimple.org/bug/view/5350

Re: Ajax problem due to the empty line in the beginning of the page output

Posted: Mon Dec 27, 2010 9:10 pm
by RonnyK
oops,

only now I see (after being told), that it is the backend which you are talking about ;) I was looking for the frontend templates.

Ronny

Re: Ajax problem due to the empty line in the beginning of t

Posted: Wed Feb 29, 2012 12:39 pm
by scooper
I just came across this problem when moving a new (1.10.3) site across from a development server.
On the dev server everything worked fine but on the live server the problem that Sonya describes above occurred with the result that the client couldn't expand / contract pages.

After much poking around I found that one of the modules (Showtime) was reported as having 'invalid CR/LF or Null characters' when opened in my Editplus (in Geany and other text editors it opens with extra line breaks).

Quite why it was working on one server and not the other I still don't know - they were both unix boxes with very similar specs, but opening all the files in Editplus and saving them back out with the linebreaks fixed solved the problem. No blank lines at the start of the html and no xml errors.

Hope that gives a clue for anyone with the same issue.

s.