Opened 14 years ago
Closed 13 years ago
#18461 closed defect (bug) (fixed)
adding a capability to a non-existing role gives warnings
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 3.5 | Priority: | normal |
| Severity: | normal | Version: | 3.2.1 |
| Component: | Role/Capability | Keywords: | has-patch |
| Focuses: | Cc: |
Description
When a plugin does something like this:
global $wp_roles;
$wp_roles->add_cap('a_nonexistent_role', 'any_capability');
no error (about the non-existance of the role) is displayed.
However, each subsequent page request produces this errormessage:
Notice: Undefined index: name in /mnt/web7/...../wordpress/wp-includes/capabilities.php on line 113
Debug is on: define('WP_DEBUG', true); in wp-config.php
Attachments (2)
Change History (7)
#3
@
14 years ago
18461.2.patch introduces isset() checks for add_cap() and remove_cap().
I don't think we should automatically remove an invalid role here. It can be removed with remove_role(), in the same way it was added.
Note: See
TracTickets for help on using
tickets.
This patch i invented myself already.
I would like a solution to add_cap(), and a way to remove the invalid (nameless) role i seem to have created.