We have recently upgraded our OJS install from 2.4.8 to 3.1.1.4. All seemed ok, but we overlooked the popups that appeared at the submission tabs: ##api.submissions.unknownError## error. Tried to solve this in the htaccess / config, but until now nothing works and tried a things suggested in the forum. I hope someone can help us.
I get Javacript errors in the Google Chrome console. When I do a request on one of the urls: http://test-ojs3.ub.rug.nl//tvs/api/v1/submissions?status=1&assignedTo=-1&searchPhrase=&count=20&offset=0&=1552984100147
I get this error in the Apache errorlog:
[Tue Mar 19 09:29:33.860283 2019] [proxy_fcgi:error] [pid 23948] [client 129.125.136.79:56909] AH01071: Got error ‘PHP message: PHP Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /nfs/www/test-ojs3/lib/pkp/lib/adodb/adodb.inc.php on line 1003\nPHP message: PHP Warning: Declaration of PKPUsageEventPlugin::getEnabled() should be compatible with LazyLoadPlugin::getEnabled($contextId = NULL) in /nfs/www/test-ojs3/lib/pkp/plugins/generic/usageEvent/PKPUsageEventPlugin.inc.php on line 0\nPHP message: PHP Warning: Declaration of SubmissionFileDAO::fromRow($row) should be compatible with PKPSubmissionFileDAO::fromRow($row, $fileImplementation) in /nfs/www/test-ojs3/classes/article/SubmissionFileDAO.inc.php on line 23\nPHP message: PHP Fatal error: Uncaught RuntimeException: Unexpected data in output buffer. Maybe you have characters before an opening <?php tag? in /nfs/www/test-ojs3/lib/pkp/lib/vendor/slim/slim/Slim/App.php:622\nStack trace:\n#0 /nfs/www/test-ojs3/lib/pkp/lib/vendor/slim/slim/Slim/App.php(334): Slim\App->finalize(Object(APIResponse))\n#1 /nfs/www/test-ojs3/lib/pkp/classes/core/APIRouter.inc.php(109): Slim\App->run()\n#2 /nfs/www/test-ojs3/lib/pkp/classes/core/Dispatcher.inc.php(134): APIRouter->route(Object(Request))\n#3 /nfs/www/test-ojs3/lib/pkp/classes/core/PKPApplication.inc.php(247): Dispatcher->dispatch(Object(Request))\n#4 /nfs/www/test-ojs3/index.php(68): PKPApplication->execute()\n#5 {main}\n thrown in /nfs/www/test-ojs3/lib/pkp/lib/vendor/slim/slim/Slim/App.php on line 622\n’
This seems like an old issue, but we can’t find a solution for our problem.
Was the upgrade process successful? If you performed it through command line tool you should see a notice about that or an error.
Following StackOverflow, one of the reasons might be closing PHP tag somewhere. Also, it can be output_buffering setting inside php.ini (it should be on) But I never got such a problem on my OJS instances with that particular error. Probably @NateWr knows more.
From the sounds of it, something is printing to the buffer too early. The most common cause of this is when PHP prints notices and warnings to the buffer. You can try turning off error reporting just as a test to see if that helps.
Otherwise, I’d recommend looking at the actual response you get in the browser when hitting the API. You can inspect this in your browser’s dev tools, under the Network tab, when looking at XHR requests. (Look for the Response area.) That will show you the actual response you received and that might give you clues as to what is in the output buffer that is causing problems.
It looks like there are spaces before <?php tags or after ?> tags somewhere in the codebase. I added the following to line 621 in /lib/pkp/lib/vendor/slim/slim/Slim/App.php as a work-around
// HACK Clean output buffering if it contains only spaces
if (ob_get_length() > 0 && (strlen(trim(ob_get_contents())) === 0)) {
ob_clean();
}
The ?> closing tags have been removed starting with OJS 3.1.2.
I would suggest watching for space before the starting <?php tags, and ensuring that file permissions aren’t e.g. allowing another errant app on the server to modify files in your cache and cache/t_compile directories.
Regards,
Alec Smecher
Public Knowledge Project Team