Error in REST API
Moderators: Developer, Contributor
Error in REST API
Hi,
I'm testing REST API in Mantis 2.14.0 and I receive followin error:
curl --request GET 'mantis/api/rest/issues?filter_id=monitored' --header 'Authorization: xyz'
<br />
<b>Fatal error</b>: Uncaught exception 'RuntimeException' with message 'Unexpected data in output buffer. Maybe you have characters before an opening <?php tag?' in mantis/vendor/slim/slim/Slim/App.php:604
Stack trace:
#0 mantis/vendor/slim/slim/Slim/App.php(316): Slim\App->finalize(Object(Slim\Http\Response))
#1 mantis/api/rest/index.php(106): Slim\App->run()
#2 {main}
thrown in <b>mantis/vendor/slim/slim/Slim/App.php</b> on line <b>604</b><br />
I'm testing REST API in Mantis 2.14.0 and I receive followin error:
curl --request GET 'mantis/api/rest/issues?filter_id=monitored' --header 'Authorization: xyz'
<br />
<b>Fatal error</b>: Uncaught exception 'RuntimeException' with message 'Unexpected data in output buffer. Maybe you have characters before an opening <?php tag?' in mantis/vendor/slim/slim/Slim/App.php:604
Stack trace:
#0 mantis/vendor/slim/slim/Slim/App.php(316): Slim\App->finalize(Object(Slim\Http\Response))
#1 mantis/api/rest/index.php(106): Slim\App->run()
#2 {main}
thrown in <b>mantis/vendor/slim/slim/Slim/App.php</b> on line <b>604</b><br />
Re: Error in REST API
I was not able to reproduce.
Did you check what the message is telling?
Did you check what the message is telling?
E.g. there could be someting wrong with your config_inc.phpMaybe you have characters before an opening <?php tag?'
Re: Error in REST API
Hi,
Yes, of course I checked it in the first place. There are no characters before it.
# --- API Configuration ---
$g_webservice_rest_enabled = ON;
Yes, of course I checked it in the first place. There are no characters before it.
Could you suggest what may be wrong with it? Only thing in config_inc.php that refers to REST API is:
# --- API Configuration ---
$g_webservice_rest_enabled = ON;
Last edited by mwas01 on 30 May 2018, 08:00, edited 1 time in total.
Re: Error in REST API
It's us-ascii so it's UTF-8 without BOM. I'll appreciate any other idea
Re: Error in REST API
Do you have installed a 3rd party plugin?
Do you use custom functions?
Did you customize strings in custom_strings_inc.php?
Did you change any original Mantis code?
Which PHP version do you use?
Do you use custom functions?
Did you customize strings in custom_strings_inc.php?
Did you change any original Mantis code?
Which PHP version do you use?
Re: Error in REST API
1. No, no 3rd party plugins are installed.
2. No.
3. Yes, there are several custom strings added.
4. No, it's standard Mantis release.
5. 5.6.32
Re: Error in REST API
Check that
- custom_strings_inc.php is UTF-8 without BOM
- there is no character before PHP open tag in custom_strings_inc.php
- there is no character after PHP close tag in custom_strings_inc.php (or ensure that there is no PHP close tag at the end of the file)
- custom_strings_inc.php is UTF-8 without BOM
- there is no character before PHP open tag in custom_strings_inc.php
- there is no character after PHP close tag in custom_strings_inc.php (or ensure that there is no PHP close tag at the end of the file)
Re: Error in REST API
I checked it, all files have UTF-8 without BOM encoding, there are no characters before php tag in custom_strings_inc, I removed close tag. I'm still getting same result.
Re: Error in REST API
I get exactly the same error message.
Re: Error in REST API
To be sure, other pages like <YourMantisURL>/my_view_page.php don't show any error?
Do you use a proxy to access your Mantis server?
Do you have configured some special rewrite rules on your web server?
Do you use a proxy to access your Mantis server?
Do you have configured some special rewrite rules on your web server?
-
- Posts: 3
- Joined: 18 Jun 2019, 13:59
Re: Error in REST API
I have the same problem. Api not work. I got the answer, for example:
At api/rest folder inside error_log i found some errors:
or like this:jquery-2.2.4.min.js:4 GET https://.../bugreports/api/rest/index.php/plugins/Snippets/help 500
Snippets/snippets.js:147 Error occurred while retrieving Snippets pattern help
I have this error with Chrome or FF browsers. But when I try IE or EDGE all works just fine. I have tried both MantisBT 2.21.0 and MantisBT 2.21.1.https://.../bugreports/api/rest/index.php/lang Failed to load resource: the server responded with a status of 500 ()
At api/rest folder inside error_log i found some errors:
[18-Jun-2019 17:09:23 Europe/Kiev] PHP Fatal error: Uncaught exception 'RuntimeException' with message 'Unexpected data in output buffer. Maybe you have characters before an opening <?php tag?' in /.../.../bugreports/vendor/slim/slim/Slim/App.php:625
Stack trace:
#0 /.../.../bugreports/vendor/slim/slim/Slim/App.php(333): Slim\App->finalize(Object(Slim\Http\Response))
#1 /.../.../bugreports/api/rest/index.php(106): Slim\App->run()
#2 {main}
thrown in /.../.../bugreports/vendor/slim/slim/Slim/App.php on line 625
-
- Posts: 3
- Joined: 18 Jun 2019, 13:59
Re: Error in REST API
Well, I found more relative information. When I select at user settings English language all works fine in all browsers. When I change language to Russian - error occurs at all browsers (including EDGE). So this error not browser related but language. Any suggestions?