[wp-trac] [WordPress Trac] #58039: Fix non-strict checking issue on options-writing.php file
WordPress Trac
noreply at wordpress.org
Sat Apr 1 11:26:27 UTC 2023
#58039: Fix non-strict checking issue on options-writing.php file
------------------------------+-----------------------------
Reporter: faisalahammad | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: trunk
Severity: normal | Keywords: needs-patch
Focuses: coding-standards |
------------------------------+-----------------------------
This PR fixes a non-strict checking issue on the WordPress file options-
writing.php. Specifically, on line 209, the code uses the "==" operator
instead of the "===" operator. This can cause unexpected behavior since
the "==" operator can coerce values and compare them in unexpected ways.
The fix involves replacing the "==" operator with the "===" operator to
perform a strict comparison between the value returned by the get_option()
function and the integer 1. This ensures that the comparison is done in a
type-safe way and that unexpected behavior is avoided.
The fixed code is as follows:
{{{
<?php if ( 1 === get_option( 'blog_public' ) ) : ?>
}}}
With this fix, the code in the options-writing.php file will be more
reliable and less prone to unexpected behavior.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58039>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list