Forum

function returnErro...
 
Notifications
Retirer tout

function returnError in api/index.php returns invalid JSON

2 Posts
2 Utilisateurs
0 Reactions
1,765 Vu
(@wolfmanx)
Posts: 1
New Member
Début du sujet
 
[#6433]

The function:returnError in file api/index.php

function returnError($error, $message) {
	echo '{"error":"'.$error.'", "message":"'.$message.'"}';
	exit;
}

returns invalid JSON without escaping NEWLINES.

A quick fix is:

function returnError($error, $message) {
    echo '{"error":'.json_encode($error).', "message": '.json_encode($message).'}';
    exit;
}

 
Posté : 7 Jan AM 04:011
(@babynus)
Posts: 14952
Membre Admin
 

You're right !
Fix will be included in next patch

Thanks for pointing out the issue and proposing a fix.


 
Posté : 7 Jan AM 11:011
Share:
Retour en haut