General: Correct force_ssl_content() to always return a boolean value.

This aims to bring parity with `force_ssl_admin()`.

Includes:
* Allowing `force_ssl_content()` to properly accept `false` as a value.
* Correcting an erroneous `! $force` conditional that should have been reversed.
* Adding unit tests to confirm valid behavior.

Follow-up to [https://mu.trac.wordpress.org/changeset/1979 mu:1979], [11903], [12603], [47808], [59830].

Props justlevine for initial patch.
See #52217.
Built from https://develop.svn.wordpress.org/trunk@60147


git-svn-id: http://core.svn.wordpress.org/trunk@59483 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov
2025-04-08 18:04:29 +00:00
parent 894ad33282
commit 95f9ddbe45
2 changed files with 5 additions and 5 deletions

View File

@@ -2420,15 +2420,15 @@ Thanks!
*
* @since 2.8.5
*
* @param bool $force
* @param bool|null $force Optional. Whether to force SSL in admin screens. Default null.
* @return bool True if forced, false if not forced.
*/
function force_ssl_content( $force = '' ) {
function force_ssl_content( $force = null ) {
static $forced_content = false;
if ( ! $force ) {
if ( ! is_null( $force ) ) {
$old_forced = $forced_content;
$forced_content = $force;
$forced_content = (bool) $force;
return $old_forced;
}

View File

@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.9-alpha-60142';
$wp_version = '6.9-alpha-60147';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.