Make WordPress Core

Opened 12 years ago

Closed 10 years ago

Last modified 10 years ago

#21526 closed defect (bug) (wontfix)

get_post_type_capabilities() assumes $args->capabilities is an array

Reported by: wpsmith's profile wpsmith Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Role/Capability Keywords:
Focuses: Cc:

Description

get_post_type_capabilities() assumes $args->capabilities is an array and should check and confirm it. Otherwise a warning appears: Warning: array_merge() [function.array-merge]: Argument # 2 is not an array in /home/username/public_html/wp-includes/post.php on line 1183. I discovered this when I accidentally set this to null instead of array().

Type setting it seems to clear the warning, if we want to clear the warning.

$capabilities = array_merge( $default_capabilities, (array)$args->capabilities );

Attachments (1)

21526-post_capabilities_array_merge.patch (557 bytes) - added by wpsmith 12 years ago.

Download all attachments as: .zip

Change History (6)

#1 @wpsmith
12 years ago

  • Keywords dev-feedback 2nd-opinion added

#2 @dd32
12 years ago

This feels like a user error, and a error that should be left in place so that Developers *know* they've passed something wrong in..

#3 @wpsmith
10 years ago

  • Keywords close added; dev-feedback 2nd-opinion removed

I concur. Let's close this as won't fix.

#4 @wpsmith
10 years ago

  • Resolution set to wontfix
  • Status changed from new to closed

#5 @DrewAPicture
10 years ago

  • Keywords close removed
  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.