Hey all, I hope someone can point me in the right direction:
I'm fairly sure this is caused by an extension we've written, but I don't know where to look.
We are using MW 1.13.2 and are not able to upgrade at this time. We work on a closed system, and have written *many* extensions and hooks to our wiki. We have only two extensions to the API. There is no extra whitespace or output from the API extensions. (I comment out the include and the $wgAPIModules['function'] lines for both of them, call the API and still get the error. I tried calling the live wikipdeia api and do not get this error. So the bug is very likely our own, but I don't know where to look.
I get the following error when I call the API (any action)
XML Parsing Error: XML or text declaration not at start of entity Location: http://localhost/path/to/wiki/api.php?action=actionx Line Number 2, Column 1:
Where else should I look for the output/whitespace?
Thanks, Sean
2009/12/16 Prunka, Sean PRUNKAS@battelle.org:
Hey all, I hope someone can point me in the right direction:
I'm fairly sure this is caused by an extension we've written, but I don't know where to look.
We are using MW 1.13.2 and are not able to upgrade at this time. We work on a closed system, and have written *many* extensions and hooks to our wiki. We have only two extensions to the API. There is no extra whitespace or output from the API extensions. (I comment out the include and the $wgAPIModules['function'] lines for both of them, call the API and still get the error. I tried calling the live wikipdeia api and do not get this error. So the bug is very likely our own, but I don't know where to look.
I get the following error when I call the API (any action)
XML Parsing Error: XML or text declaration not at start of entity Location: http://localhost/path/to/wiki/api.php?action=actionx Line Number 2, Column 1:
Where else should I look for the output/whitespace?
The whitespace could be in any file, anywhere (although it's very likely not in MW core). Look through your extension files (including third-party extensions) and: * Kill leading whitespace before first <?php * Remove the ?> tag at the end, it's unnecessary * Carefully inspect inline HTML between ?> and <?php , if any, and convince yourself it's conditional
You could also try disabling extensions (by commenting out the require_once line in LocalSettings.php) one by one until you find the guilty one.
Roan Kattouw (Catrope)
Thanks. The last bit is the one I'm hitting already. We have a Java Programmer that uses require_once in every file that calls the other files, so it's a nice tangled mess, but I am sorting it all out. I think I've gotten narrowed done to a handful of possible culprits.
I'm expecting to find an extra line after a closing tag... but I had forgotten to check for leading whitespace. Thanks again!
-----Original Message----- From: mediawiki-api-bounces@lists.wikimedia.org [mailto:mediawiki-api-bounces@lists.wikimedia.org] On Behalf Of Roan Kattouw Sent: Wednesday, December 16, 2009 10:10 AM To: MediaWiki API announcements & discussion Subject: Re: [Mediawiki-api] XML parsing error?
2009/12/16 Prunka, Sean PRUNKAS@battelle.org:
Hey all, I hope someone can point me in the right direction:
I'm fairly sure this is caused by an extension we've written, but I don't know where to look.
We are using MW 1.13.2 and are not able to upgrade at this time. We work on a closed system, and have written *many* extensions and hooks to our wiki. We have only two extensions to the API. There is no extra whitespace or output from the API extensions. (I comment out the include and the $wgAPIModules['function'] lines for both of them, call the API and still get the error. I tried calling the live wikipdeia api and do not get this error. So the bug is very likely our own, but I don't know where to look.
I get the following error when I call the API (any action)
XML Parsing Error: XML or text declaration not at start of entity Location: http://localhost/path/to/wiki/api.php?action=actionx Line Number 2, Column 1:
Where else should I look for the output/whitespace?
The whitespace could be in any file, anywhere (although it's very likely not in MW core). Look through your extension files (including third-party extensions) and: * Kill leading whitespace before first <?php * Remove the ?> tag at the end, it's unnecessary * Carefully inspect inline HTML between ?> and <?php , if any, and convince yourself it's conditional
You could also try disabling extensions (by commenting out the require_once line in LocalSettings.php) one by one until you find the guilty one.
Roan Kattouw (Catrope)
_______________________________________________ Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Prunka, Sean wrote:
Thanks. The last bit is the one I'm hitting already. We have a Java Programmer that uses require_once in every file that calls the other files, so it's a nice tangled mess, but I am sorting it all out. I think I've gotten narrowed done to a handful of possible culprits.
I'm expecting to find an extra line after a closing tag... but I had forgotten to check for leading whitespace. Thanks again!
Note that ?> at the end of file is optional, so you can remove it and that way there won't be any extra line.
Another possibility is that one of your files has a BOM on one file (some editors, like notepad like to add them). It's a tricky issue since many editors won't display it, being invisible on editing but still breaking your php pages.
2009/12/16 Prunka, Sean PRUNKAS@battelle.org:
Thanks. The last bit is the one I'm hitting already. We have a Java Programmer that uses require_once in every file that calls the other files, so it's a nice tangled mess, but I am sorting it all out. I think I've gotten narrowed done to a handful of possible culprits.
Do you know about $wgAutoloadClasses? Look at any extension setup file in our SVN repo for example usage. Once a class is registered there, it'll automatically be loaded when it's needed.
Roan Kattouw (Catrope)
Thanks again for the tips. (Thanks to Platonides as well!) We've got it all sorted out now, and it was, indeed, an extra line after a "?>" in an class file.
-----Original Message----- From: mediawiki-api-bounces@lists.wikimedia.org [mailto:mediawiki-api-bounces@lists.wikimedia.org] On Behalf Of Roan Kattouw Sent: Wednesday, December 16, 2009 12:03 PM To: MediaWiki API announcements & discussion Subject: Re: [Mediawiki-api] XML parsing error?
2009/12/16 Prunka, Sean PRUNKAS@battelle.org:
Thanks. The last bit is the one I'm hitting already. We have a Java Programmer that uses require_once in every file that calls the other files, so it's a nice tangled mess, but I am sorting it all out. I think I've gotten narrowed done to a handful of possible culprits.
Do you know about $wgAutoloadClasses? Look at any extension setup file in our SVN repo for example usage. Once a class is registered there, it'll automatically be loaded when it's needed.
Roan Kattouw (Catrope)
_______________________________________________ Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
mediawiki-api@lists.wikimedia.org