Why is user_role_change_permissions() throwing an error?
It should be like this:

if($user-&gt;uid == "0"){
  $custom_role = user_role_load_by_name('anonymous user'); 
  $custom_rid = $custom_role-&gt;rid; 
  $custom_permissions = array('view content hits');
  user_role_change_permissions($custom_rid, $custom_permissions);
 }


Here you have given 


  $custom_permissions = array(
      'view content hits' => TRUE,   );


TRUE should not be there.