[wp-trac] [WordPress Trac] #52484: The wp_update_https_detection_errors function may fail to update option values.
WordPress Trac
noreply at wordpress.org
Wed Feb 10 08:03:45 UTC 2021
#52484: The wp_update_https_detection_errors function may fail to update option
values.
--------------------------+-----------------------------
Reporter: tmatsuur | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: HTTP API | Version:
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
In a development environment that does not support HTTPS, the "Update your
site to use HTTPS" button was displayed in Site Health, so I investigated
the cause.
OS: Windows 10(Japanese)
PHP: 7.2.3
Web: Apache 2.4
The reason for this was that the return value of the wp_is_https_supported
function was true.
The wp_is_https_supported function updates the value of
"https_detection_errors", but in this case the add_option function fails
to update the wp_options table.
{{{
update_option( 'https_detection_errors', $support_errors->errors );
}}}
The reason is that the content of "$support_errors->errors" obtained by
the wp_update_https_detection_errors function was garbled.
{{{
array(1) {
["http_request_failed"]=>
array(1) {
[0]=>
string(68) "�Ώۂ̃R���s���[�^�[�ɂ���ċ��ۂ��ꂽ���߁A�ڑ��ł��܂���ł����B
"
}
}
}}}
The garbled text looks like this when encoded in UTF-8.
{{{
string(101) "対象のコンピューターによって拒否されたため、接続できませんで
した。
"
}}}
It's a simple change, but you can update the table by making the following
changes:
{{{
update_option( 'https_detection_errors', map_deep(
$support_errors->errors, 'sanitize_text_field' ) );
}}}
I think the content of "$support_errors->errors" needs to be sanitized or
the character encoding needs to be converted to UTF-8.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/52484>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list