Make WordPress Core

Opened 2 years ago

Last modified 2 years 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.


2 years ago
#1

  • Keywords has-patch has-unit-tests added

#2 @costdev
2 years 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
2 years 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.