[wp-trac] [WordPress Trac] #57262: force_ssl_admin can be set to return a string
WordPress Trac
noreply at wordpress.org
Tue Dec 13 19:54:22 UTC 2022
#57262: force_ssl_admin can be set to return a string
-------------------------------------------------+-------------------------
Reporter: pbearne | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting
| Review
Component: General | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests dev- | Focuses:
feedback |
-------------------------------------------------+-------------------------
Comment (by autotutorial):
The default static variable is false and a string is allowed when used
with the FORCE_SSL_ADMIN constant, returning if not null is the old value.
{{{#!php
<?php
<?php
define('FORCE_SSL_ADMIN', 'false' );
function force_ssl_admin( $force = null ) {
static $forced = false;
if ( ! is_null( $force ) ) {
$old_forced = $forced;
$forced = $force;
return $old_forced;
}
return $forced;
}
$test1 = (bool) force_ssl_admin(); // cast for user
$test2 = (bool) force_ssl_admin( FORCE_SSL_ADMIN ); //cast for user
$test3 = (bool) force_ssl_admin(); // cast for user
$test4 = force_ssl_admin( 'string '); // string
var_dump( $test1, $test2, $test3, $test4);
?>
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57262#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list