OK, this will likely be due to array handling for parameters in PHP:
Change the function to:
function editCategoryPermissions( $categoryId, $permissions, $username = 'system' ) {
$params = array();
foreach ( $permissions as $group => $permission ) {
$params['permissions[' . $group . ']'] = $permission;
}
if ( empty( $params ) ) {
// @todo consider throwing an exception here
// sending empty parameters is most likely bad
}
return $this->_putRequest( '/categories/' . $categoryId, $params, $username );
}
And call as you did before:
$r = $api->editCategoryPermissions( 641, array( 'admins' => 1 ) );