-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTTP listener false positive error for non-blocking requests #26
Comments
Hi @luisarn, even if it's a brand new install, WordPress sends HTTP requests to handle its default "cron" tasks (some info here https://developer.wordpress.org/plugins/cron/). Normally Wonolog recognizes those cron requests and log it properly. However, what I see here is that in your case the request is not recognized as a cron request (I see I will try to figure out if this is a Wonolog bug or it could be an issue with your installation / server setup. |
Hi @gmazapp, thanks for the reply! Please find below my server details to aid your investigation: SLES11 You can install the plugin wp-crontrol and run the default wp cron jobs to trigger the error. Best regards, |
After a quick debug, I think I might found the issue: In the HttpApiListener.php: private function is_error( $response ) {
if ( is_wp_error( $response ) ) {
return TRUE;
}
if ( ! isset( $response[ 'response' ][ 'code' ] ) ) {
return FALSE;
}
if ( ! is_numeric( $response[ 'response' ][ 'code' ] ) ) {
return TRUE;
}
$code = (int) $response[ 'response' ][ 'code' ];
return ! in_array( $code, self::$http_success_codes );
} 1 - Wonolog checks the response if is a WP Error by passing the response to the is_wp_error function. In my case is_wp_error returns false which I assume it's not an error. I believe this is a false alarm so by adding the following checking on the 2nd step might fix the issue: if ( ! isset( $response[ 'response' ][ 'code' ] ) || empty( $response[ 'response' ][ 'code' ] ) ) {
return FALSE;
} unless the empty response code is really an error. |
Hi @luisarn and thanks for the time you spent on this. Yes, I was aware of the code, but I thought that when the request is not blocking the response was empty, so it would not pass the second Btw, I will fix this skipping the response code check for non-blocking requests. Thanks again. |
Hi @gmazzap, Confirmed! The false positive error for non-blocking requests is fixed. Thank you! |
Version Information
Steps to Reproduce
What I Expected
Nothing is shown on the error log since it's a brand new install without anything else.
What Happened Instead
Wonolog keeps registering the following error:
The text was updated successfully, but these errors were encountered: