Change WordPress user roles and capabilities › Forums › Bug Reports › Being redirected to the Media Library when selecting a file in Theme/Editor › Reply To: Being redirected to the Media Library when selecting a file in Theme/Editor
Issue with redirection may be related to these details of admin menu access module realization.
Do you know that any user with access to .php file editing can get full access to the site in a seconds? Just couple lines of PHP code may give full access. Thus, there is no sense to limit access for user with .php editing permissions in any way. You should trust such users. It’s a good practice to block file editing at production sites. Even trusted user may lead to site crash due to unintended mistake or even typo during file editing.