Skip to content

54803 — Fix docblocks for https_ssl_verify and https_local_ssl_verify#3837

Closed
mcaskill wants to merge 1 commit intoWordPress:trunkfrom
mcaskill:ticket/54803-fix-docblocks
Closed

54803 — Fix docblocks for https_ssl_verify and https_local_ssl_verify#3837
mcaskill wants to merge 1 commit intoWordPress:trunkfrom
mcaskill:ticket/54803-fix-docblocks

Conversation

@mcaskill
Copy link

The https_ssl_verify and https_local_ssl_verify filters 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 false instead of true.

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

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
@github-actions
Copy link

Hi @mcaskill! 👋

Thank you for your contribution to WordPress! 💖

It looks like this is your first pull request to wordpress-develop. Here are a few things to be aware of that may help you out!

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,
The WordPress Project

* @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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you clarify whey you use ? before string?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

@johnbillion johnbillion Jan 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I marked it as explicitly nullable if ever an implementation that uses these hooks passes null as 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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Thanks for the clarification.

@johnbillion
Copy link
Member

@mcaskill mcaskill deleted the ticket/54803-fix-docblocks branch November 19, 2023 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants