[wp-trac] [WordPress Trac] #50913: PHP 8.0: various compatibility fixes

WordPress Trac noreply at wordpress.org
Fri Sep 11 02:21:03 UTC 2020

#50913: PHP 8.0: various compatibility fixes
 Reporter:  jrf                            |       Owner:  SergeyBiryukov
     Type:  task (blessed)                 |      Status:  reviewing
 Priority:  normal                         |   Milestone:  5.6
Component:  General                        |     Version:
 Severity:  normal                         |  Resolution:
 Keywords:  php8 has-patch needs-dev-note  |     Focuses:  coding-standards

Comment (by SergeyBiryukov):

 Replying to [comment:20 jeherve]:
 > After this change, and considering @jrf's comment, should we consider
 updating `map_meta_cap` to take this into account, when no arguments are
 passed and `get_comment( $args[0] )` now produces a notice?
 > -- https://core.trac.wordpress.org/browser/trunk/src/wp-

 Thanks for bringing this up.

 If the notice comes from `current_user_can( 'edit_comment' )`, that
 doesn't seem any different from `edit_post` and similar checks:
 * `current_user_can( 'delete_post' )`
 * `current_user_can( 'edit_post' )`
 * `current_user_can( 'read_post' )`
 * `current_user_can( 'publish_post' )`

 These all require a post ID to check, and will cause a PHP warning if the
 ID is not provided. Performing these checks without passing in a post ID
 (or a comment ID, in case of `edit_comment`) is a developer error, so I
 think the warning is legitimate, hiding it would only make debugging

 See also: comment:2:ticket:48415

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

More information about the wp-trac mailing list