Make WordPress Core

Opened 18 months ago

Last modified 18 months ago

#57266 new defect (bug)

wp_suspend_cache_invalidation can be set to no Boolean value which break usage

Reported by: pbearne's profile pbearne Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch has-unit-tests
Focuses: Cc:

Description


Change History (3)

This ticket was mentioned in PR #3722 on WordPress/wordpress-develop by @pbearne.


18 months ago
#1

  • Keywords has-patch has-unit-tests added

#2 @costdev
18 months ago

Nicely spotted @pbearne!

Looks like we can do something along these lines:

<?php

if ( ! is_bool( $suspend ) ) {
    _doing_it_wrong(
        __FUNCTION__,
        sprintf(
            /* translators: %s: The "$suspend" variable name. */
            __( '"%s" must be of type "bool".' ),
        ),
        '6.2.0'
    );

    $suspend = (bool) $suspend;
}

#3 @pbearne
18 months ago

I wasn't sure I could do that
I prefer trying to cast the value
This does been that any string not "false" set the value to True

new version uploaded

Note: See TracTickets for help on using tickets.