It is most likely that I produced this error by myself when I edited or patched the OJS source files. I'm running OJS 2.4.2 now, having patched step-by-step from 2.3.7. I think the problem first appeared since I patched from 2.4.1 to 2.4.2, but I'm not sure about it. The problem occurs with all kind of XML output, not just one specific plugin (I tried user export, native article export, CrossRef export).
Anyway, after many, many hours of fruitless searching I post my problem here for two reasons:
- I want to make sure that it's an individual error of my installation and not commonly shared with others.
- I am hoping for somebody who could give me an advice concerning a solution strategy.
What I have done so far:
- I have gone through all PHP files in /classes, /pages, /plugins, /tools, /lib/pkp/classes, /lib/pkp/includes, /lib/pkp/pages, /lib/pkp/plugins, and /lib/pkp/tools with regular expressions to find line-breaks and space characters before or after the PHP declarations: "\?>[\s\l\n\r]+" and "[\s\l\n\r]+<\?php". I've found a few hazardous space characters that I eliminated. I also removed traling \n and \r characters after the "?>" even though I think that those should not be a problem by themselves. That didn't solve the problem, though.
- Because I'm sometimes working on windows systems and sometimes on linux, and the webserver is running linux, I made sure that there's no hiccup caused by different line-breaks. I've run "dos2unix" on the webserver on all OJS files to make sure the line-breaks are consistant.
- I've wrapped an xdebug_trace around the call to generate one xml export and manually checked through the files whose methods are used in the process. The trace was clearly showing that the printXML() function in the XMLCustomWriter of OJS was returning a correct XML file with no empty line before the XML declaration. Therefore it was useless, to wrap the output of printXML() with an additional trim(). (I had tried that as well, however, before I found the correct XML output in the trace.
I'm at a loss now and don't know what else to check. Any ideas?