Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #49628, comment 16


Ignore:
Timestamp:
11/07/2021 01:25:51 AM (3 years ago)
Author:
Cybr
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #49628, comment 16

    initial v1  
    66
    771. The documentation clearly states it should be a boolean.
    8 2. The return value can be cast to a boolean `(bool) $is_viewable`, which should suffice.
     82. The return value can be cast to a boolean, which should suffice: `return (bool) $is_viewable;`
    99
    10 This adds 3 extra opcodes, of which 1 jump -- roughly 17 times per request on a clean install.
     10Currently, this defense adds 3 extra opcodes, of which 1 jump -- roughly 17 times per request on a clean install.
    1111
    1212If we want to focus on performance, we need to be reticent with introducing defensive code and expect developers to abide by the types. I think this is especially true (pun intended) for newly introduced and substantially better-documented functions/methods/filters/actions.