WordPress.org

Make WordPress Core

Opened 21 months ago

Last modified 4 weeks ago

#21526 new defect (bug)

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

Reported by: wpsmith Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Role/Capability Keywords: close
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 21 months ago.

Download all attachments as: .zip

Change History (4)

comment:1 wpsmith21 months ago

  • Keywords dev-feedback 2nd-opinion added

comment:2 dd3221 months 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..

comment:3 wpsmith4 weeks ago

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

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

Note: See TracTickets for help on using tickets.