[wp-trac] [WordPress Trac] #63068: Administrator Role Changed to "No Roles" Causes Internal Server Error

WordPress Trac noreply at wordpress.org
Tue Feb 17 15:45:11 UTC 2026


#63068: Administrator Role Changed to "No Roles" Causes Internal Server Error
-------------------------------------------------+-------------------------
 Reporter:  jomonthomaslobo1                     |       Owner:  audrasjb
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:  7.0
Component:  General                              |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch dev-feedback has-test-     |     Focuses:
  info                                           |  administration
-------------------------------------------------+-------------------------

Comment (by huzaifaalmesbah):

 == Patch Testing Report

 Patch Tested: https://github.com/WordPress/wordpress-develop/pull/8829

 === Environment

 - WordPress: 7.0-alpha-61215-src
 - PHP: 8.2.29
 - Server: nginx/1.29.5
 - Database: mysqli (Server: 8.4.8 / Client: mysqlnd 8.2.29)
 - Browser: Chrome 145.0.0.0
 - OS: macOS
 - Theme: Twenty Twenty-Five 1.4
 - MU Plugins: None activated
 - Plugins:
   * Test Reports 1.2.1

 === Steps Taken

 1. Confirmed there is only one Administrator user on the site.
 2. Logged in as that Administrator.
 3. Navigated to Users → All Users.
 4. Edited the Administrator account.
 5. Changed the role to “— No role for this site —”.
 6. Clicked Update.
 7. Result (Before Patch):
 - Warning: Undefined array key "" in /var/www/src/wp-admin/users.php on
 line 148
 - Fatal error: Uncaught Error: Call to a member function has_cap() on null
 in /var/www/src/wp-admin/users.php:148
 - Stack trace: #0 {main} thrown in /var/www/src/wp-admin/users.php on line
 148
 - The site returned a fatal error and became inaccessible (500 error).

 8. Applied PR.
 9. Repeated steps 2–6.

 10. ✅ Result (After Patch): Patch is solving the problem.

 === Expected Result

 - WordPress should prevent users from removing their own Administrator
 role.
 - The system should not allow the last Administrator role to be removed.
 - A proper error message should be displayed instead of causing a PHP
 warning or fatal error.
 - The site should remain stable and accessible.


 === Screenshots / Screencast

 - Before & After video:
   https://files.catbox.moe/qdf9nj.mp4

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63068#comment:23>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list