Error message when accessing Submissions page

Hi,

I am currently testing out an implementation of OJS 3.1.0.1. When accessing the Submissions page I receive the following error popup “An unexpected error has occurred. Please reload the page and try again”. After looking at my browsers developer tools I see the following errors:

SCRIPT5007: Unable to get property ‘trigger’ of undefined or null reference
pkp.min.js (317,449)
SCRIPT5007: Unable to get property ‘addClass’ of undefined or null reference
pkp.min.js (317,381)
SCRIPT5007: Unable to get property ‘focus’ of undefined or null reference
pkp.min.js (317,433)
SCRIPT5007: Unable to get property ‘trigger’ of undefined or null reference
pkp.min.js (317,449)
SCRIPT5007: Unable to get property ‘addClass’ of undefined or null reference
pkp.min.js (317,381)
SCRIPT5007: Unable to get property ‘focus’ of undefined or null reference
pkp.min.js (317,433)

Any help with this would be greatly appreciated.

Thank you,

Hi @abalbuena,

Check your PHP error log for details.

Regards,
Alec Smecher
Public Knowledge Project Team

Below is the error message I get from PHP:

The description for Event ID 2 from source PHP-5.6.36 cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event:

php[3424]
Slim Application Error:
Type: RuntimeException
Code: 5
Message: Malformed UTF-8 characters, possibly incorrectly encoded
File: C:\inetpub\wwwroot\ojs3101\lib\pkp\lib\vendor\slim\slim\Slim\Http\Response.php
Line: 353
Trace: #0 C:\inetpub\wwwroot\ojs3101\lib\pkp\api\v1_submissions\PKPBackendSubmissionsHandler.inc.php(157): Slim\Http\Response->withJson(Array)
#1 [internal function]: PKPBackendSubmissionsHandler->getSubmissions(Object(Slim\Http\Request), Object(APIResponse), Array)
#2 C:\inetpub\wwwroot\ojs3101\lib\pkp\lib\vendor\slim\slim\Slim\Handlers\Strategies\RequestResponse.php(41): call_user_func(Array, Object(Slim\Http\Request), Object(APIResponse), Array)
#3 C:\inetpub\wwwroot\ojs3101\lib\pkp\lib\vendor\slim\slim\Slim\Route.php(335): Slim\Handlers\Strategies\RequestResponse->__invoke(Array, Object(Slim\Http\Request), Object(APIResponse), Array)
#4 C:\inetpub\wwwroot\ojs3101\lib\pkp\lib\vendor\slim\slim\Slim\MiddlewareAwareTrait.php(117): Slim\Route->__invoke(Object(Slim\Http\Request), Object(APIResponse))
#5 C:\inetpub\wwwroot\ojs3101\lib\pkp\lib\vendor\slim\slim\Slim\Route.php(313): Slim\Route->callMiddlewareStack(Object(Slim\Http\Request), Object(APIResponse))
#6 C:\inetpub\wwwroot\ojs3101\lib\pkp\lib\vendor\slim\slim\Slim\App.php(495): Slim\Route->run(Object(Slim\Http\Request), Object(APIResponse))
#7 C:\inetpub\wwwroot\ojs3101\lib\pkp\classes\security\authorization\internal\ApiAuthorizationMiddleware.inc.php(74): Slim\App->__invoke(Object(Slim\Http\Request), Object(APIResponse))
#8 [internal function]: ApiAuthorizationMiddleware->__invoke(Object(Slim\Http\Request), Object(APIResponse), Object(Slim\App))
#9 C:\inetpub\wwwroot\ojs3101\lib\pkp\lib\vendor\slim\slim\Slim\DeferredCallable.php(43): call_user_func_array(Object(ApiAuthorizationMiddleware), Array)
#10 [internal function]: Slim\DeferredCallable->__invoke(Object(Slim\Http\Request), Object(APIResponse), Object(Slim\App))
#11 C:\inetpub\wwwroot\ojs3101\lib\pkp\lib\vendor\slim\slim\Slim\MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\DeferredCallable), Object(Slim\Http\Request), Object(APIResponse), Object(Slim\App))
#12 C:\inetpub\wwwroot\ojs3101\lib\pkp\classes\security\authorization\internal\ApiTokenDecodingMiddleware.inc.php(82): Slim\App->Slim{closure}(Object(Slim\Http\Request), Object(APIResponse))
#13 [internal function]: ApiTokenDecodingMiddleware->__invoke(Object(Slim\Http\Request), Object(APIResponse), Object(Closure))
#14 C:\inetpub\wwwroot\ojs3101\lib\pkp\lib\vendor\slim\slim\Slim\DeferredCallable.php(43): call_user_func_array(Object(ApiTokenDecodingMiddleware), Array)
#15 [internal function]: Slim\DeferredCallable->__invoke(Object(Slim\Http\Request), Object(APIResponse), Object(Closure))
#16 C:\inetpub\wwwroot\ojs3101\lib\pkp\lib\vendor\slim\slim\Slim\MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\DeferredCallable), Object(Slim\Http\Request), Object(APIResponse), Object(Closure))
#17 C:\inetpub\wwwroot\ojs3101\lib\pkp\classes\handler\APIHandler.inc.php(67): Slim\App->Slim{closure}(Object(Slim\Http\Request), Object(APIResponse))
#18 [internal function]: APIHandler->{closure}(Object(Slim\Http\Request), Object(APIResponse), Object(Closure))
#19 C:\inetpub\wwwroot\ojs3101\lib\pkp\lib\vendor\slim\slim\Slim\DeferredCallable.php(43): call_user_func_array(Object(Closure), Array)
#20 [internal function]: Slim\DeferredCallable->__invoke(Object(Slim\Http\Request), Object(APIResponse), Object(Closure))
#21 C:\inetpub\wwwroot\ojs3101\lib\pkp\lib\vendor\slim\slim\Slim\MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\DeferredCallable), Object(Slim\Http\Request), Object(APIResponse), Object(Closure))
#22 C:\inetpub\wwwroot\ojs3101\lib\pkp\classes\handler\APIHandler.inc.php(89): Slim\App->Slim{closure}(Object(Slim\Http\Request), Object(APIResponse))
#23 [internal function]: APIHandler->{closure}(Object(Slim\Http\Request), Object(APIResponse), Object(Closure))
#24 C:\inetpub\wwwroot\ojs3101\lib\pkp\lib\vendor\slim\slim\Slim\DeferredCallable.php(43): call_user_func_array(Object(Closure), Array)
#25 [internal function]: Slim\DeferredCallable->__invoke(Object(Slim\Http\Request), Object(APIResponse), Object(Closure))
#26 C:\inetpub\wwwroot\ojs3101\lib\pkp\lib\vendor\slim\slim\Slim\MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\DeferredCallable), Object(Slim\Http\Request), Object(APIResponse), Object(Closure))
#27 C:\inetpub\wwwroot\ojs3101\lib\pkp\lib\vendor\slim\slim\Slim\MiddlewareAwareTrait.php(117): Slim\App->Slim{closure}(Object(Slim\Http\Request), Object(APIResponse))
#28 C:\inetpub\wwwroot\ojs3101\lib\pkp\lib\vendor\slim\slim\Slim\App.php(388): Slim\App->callMiddlewareStack(Object(Slim\Http\Request), Object(APIResponse))
#29 C:\inetpub\wwwroot\ojs3101\lib\pkp\lib\vendor\slim\slim\Slim\App.php(296): Slim\App->process(Object(Slim\Http\Request), Object(APIResponse))
#30 C:\inetpub\wwwroot\ojs3101\lib\pkp\classes\core\APIRouter.inc.php(110): Slim\App->run()
#31 C:\inetpub\wwwroot\ojs3101\lib\pkp\classes\core\Dispatcher.inc.php(134): APIRouter->route(Object(Request))
#32 C:\inetpub\wwwroot\ojs3101\lib\pkp\classes\core\PKPApplication.inc.php(243): Dispatcher->dispatch(Object(Request))
#33 C:\inetpub\wwwroot\ojs3101\index.php(68): PKPApplication->execute()
#34 {main}
View in rendered output by enabling the “displayErrorDetails” setting.

Hi @abalbuena,

There’s some invalid UTF-8 content in your database that’s causing this. Double-check that your database character set configuration is correct (both in the the database, and in your config.inc.php); to locate the invalid data, the quickest way is probably to temporarily edit lib/pkp/lib/vendor/slim/slim/Slim/Http/Response.php near line 353 and dump the $data that couldn’t be successfully passed through json_encode.

Regards,
Alec Smecher
Public Knowledge Project Team

Alec,

Below is the code I have near line 353. Where would I add the $data variable?

public function withJson($data, $status = null, $encodingOptions = 0)
{
$response = $this->withBody(new Body(fopen(‘php://temp’, ‘r+’)));
$response->body->write($json = json_encode($data, $encodingOptions));

    // Ensure that the json encoding passed successfully
    if ($json === false) {
        throw new \RuntimeException(json_last_error_msg(), json_last_error());
    }

    $responseWithJson = $response->withHeader('Content-Type', 'application/json;charset=utf-8');
    if (isset($status)) {
        return $responseWithJson->withStatus($status);
    }
    return $responseWithJson;
}

Thanks

Hi @abalbuena,

Right above the throw new \RuntimException call, I’d suggest adding

error_log('Bad data: ' . print_r($data,true));

Regards,
Alec Smecher
Public Knowledge Project Team

Alec,

Thanks. My issue is now resolved. I followed the suggestion from the following forum post:

dear all…

I got the similar problem, when accessing submission.
Error message: An unexpected error has occurred. Please reload the page and try again

here is the error log…

[error] 9613#9613: *1213 FastCGI sent in stderr: “PHP message: ojs2: 404 Not Found” while reading response header from upstream, client: 203.189.120.14, server: ojs.petra.ac.id, request: “GET /ojs312/index.php?journal=capital&endpoint=/capital/api/v1/submissions&status%5B%5D=4&status%5B%5D=3&searchPhrase=&count=20&offset=0&=1555390619595 HTTP/1.1”, upstream: “fastcgi://unix:/var/run/php/php7.2-fpm.sock:”, host: “ojs.petra.ac.id”, referrer: “https://ojs.petra.ac.id/ojs312/index.php?journal=capital&page=submissions

please help me…thanking you very much