Hi @boabo, @felicity_gilbertson,
I’ve had a look at the relevant code (I’ve replaced irrelevant lines of code with …):
59 if ( is_ssl() ) {
...
...
...
...
...
...
67 } elseif ( 'cli' !== php_sapi_name() && ! ITSEC_Core::doing_data_upgrade() && 'GET' === $_SERVER['REQUEST_METHOD'] ) {
68 $this->redirect_to_https();
69 }
It seems to me that the condition at line 67 (as is) may create a conflict. The goal of the condition is to exclude command line interface (cli) commands from being redirected to https. Which makes sense because a cli command is not an http(s) request. So when a cli command runs there is no point to redirect to https.
However, just checking for ‘cli’ !== php_sapi_name() and then assuming it’s a http request where $_SERVER[‘REQUEST_METHOD’] exists is prone to error/PHP warning. This can easily be avoided:
67 } elseif ( 'cli' !== php_sapi_name() && ! ITSEC_Core::doing_data_upgrade() && isset( $_SERVER['REQUEST_METHOD'] ) && 'GET' === $_SERVER['REQUEST_METHOD'] ) {
As a test please make a copy of the /wp-content/plugins/better-wp-security/core/modules/ssl/class-itsec-ssl.php file. Then edit the original file (not the copy) and change line 67 to match with the above. Then start monitoring whether the issue persists (or not).
@shanedelierrr
Instead of using the PHP php_sapi_name() function it’s probably better to check for the WP_CLI constant:
67 } elseif ( defined( 'WP_CLI' ) && WP_CLI && ... ) {
68 ...
69 }
+++ To prevent any confusion, I’m not SolidWP +++
-
This reply was modified 1 month, 2 weeks ago by nlpro.
-
This reply was modified 1 month, 2 weeks ago by nlpro.
-
This reply was modified 1 month, 2 weeks ago by nlpro.