WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#30821 closed defect (bug) (duplicate)

Undefined offset: 0 in capabilities.php#L1119 - map_meta_cap()

Reported by: Ninos Ego Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.2
Component: Role/Capability Keywords: has-patch
Focuses: Cc:

Description

There should be a check for the $args[0] variable. Attached a patch...

Attachments (1)

capabilities.php.patch (1.5 KB) - added by Ninos Ego 5 years ago.

Download all attachments as: .zip

Change History (6)

#1 @Ninos Ego
5 years ago

  • Keywords has-patch added

#2 @TobiasBg
5 years ago

This could potentially hide developer/coding errors, as the capabilities to which you want to add those checks should always be checked with a corresponding object or ID.
Where exactly are you getting the error that you mention in the title of the ticket?

#3 @SergeyBiryukov
5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #13905 and #23377. See comment:3:ticket:23377.

#4 @Ninos Ego
5 years ago

After using current_user_can('edit_post') ) for example (where I used the function).

#5 @Ninos Ego
5 years ago

Changed to current_user_can( 'edit_post', get_the_ID() ). Did not know, that the second parameter is important here.

Note: See TracTickets for help on using tickets.