54803 — Fix docblocks for https_ssl_verify and https_local_ssl_verify#3837
54803 — Fix docblocks for https_ssl_verify and https_local_ssl_verify#3837mcaskill wants to merge 1 commit intoWordPress:trunkfrom mcaskill:ticket/54803-fix-docblocks
https_ssl_verify and https_local_ssl_verify#3837Conversation
Changed: - The `$ssl_verify` parameter accepts either a boolean (usually `false`) or a string path to an SSL certificate. - The `$url` parameter is often ignored such as in `WP_Site_Health`. Trac ticket: https://core.trac.wordpress.org/ticket/54803
|
Hi @mcaskill! 👋 Thank you for your contribution to WordPress! 💖 It looks like this is your first pull request to No one monitors this repository for new pull requests. Pull requests must be attached to a Trac ticket to be considered for inclusion in WordPress Core. To attach a pull request to a Trac ticket, please include the ticket's full URL in your pull request description. Pull requests are never merged on GitHub. The WordPress codebase continues to be managed through the SVN repository that this GitHub repository mirrors. Please feel free to open pull requests to work on any contribution you are making. More information about how GitHub pull requests can be used to contribute to WordPress can be found in this blog post. Please include automated tests. Including tests in your pull request is one way to help your patch be considered faster. To learn about WordPress' test suites, visit the Automated Testing page in the handbook. If you have not had a chance, please review the Contribute with Code page in the WordPress Core Handbook. The Developer Hub also documents the various coding standards that are followed:
Thank you, |
| * @param string $url The request URL. | ||
| * @param bool|string $ssl_verify Boolean to control whether to verify the SSL connection | ||
| * or path to an SSL certificate. | ||
| * @param ?string $url Optional. The request URL. |
There was a problem hiding this comment.
Can you clarify whey you use ? before string?
There was a problem hiding this comment.
I can switch the $url parameter's type to string|null, if it's preferable.
I marked it as explicitly nullable if ever an implementation that uses these hooks passes null as a second parameter instead of omitting it.
There are similar occurrences of using ? in the codebase.
There was a problem hiding this comment.
I marked it as explicitly nullable if ever an implementation that uses these hooks passes
nullas a second parameter instead of omitting it.
I can see the idea behind this, but the same applies to every parameter of every filter and action in WordPress. This is better addressed in tests and tooling rather than nulling the parameter.
There was a problem hiding this comment.
Good point. Thanks for the clarification.
The
https_ssl_verifyandhttps_local_ssl_verifyfilters are currently documented to expect and return a boolean value (whether to verify the SSL connection) and to expect a request URL.However a string value (path to SSL certificate bundle) is often provided and when a boolean is provided, it is often
falseinstead oftrue.Furthermore, the request URL is often omitted.
See
WP_Site_Health::get_test_rest_availability()for an example.Trac ticket: https://core.trac.wordpress.org/ticket/54803