I'm working with .json files and I have the following function:
//Rights array (WRITE, CREATE, DELETE, ADDUSERS, DELETE USERS)
function addUser($requester, $username, $rights) {
$file = $requester->getFolder() . "Projects/" . $this->name . "/Data/users.json";
$json = json_decode(file_get_contents($file, false));
$json[$username] = array("write" => $rights[0], "create" => $rights[1], "delete" => $rights[2], "adduser" => $rights[3], "deleteuser" => $rights[4]);
file_put_contents($file, json_encode($json));
}
Whenever I run the code that uses that function, I get the following error:
Fatal error: Cannot use object of type stdClass as array in...