projectnami icon indicating copy to clipboard operation
projectnami copied to clipboard

An unexpected error occurred in update.php

Open PHuhn opened this issue 2 years ago • 1 comments

Hey Patrick:

I've been getting the following registered in the DEBUG. logs:

[01-Jun-2023 15:42:54 UTC] PHP Warning:  An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/forums/">support forums</a>. (WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.) in C:\inetpub\WP5_GC_2021_01\wp-includes\update.php on line 224
[01-Jun-2023 15:42:54 UTC] PHP Warning:  An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/forums/">support forums</a>. (WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.) in C:\inetpub\WP5_GC_2021_01\wp-includes\update.php on line 462
[01-Jun-2023 15:42:54 UTC] PHP Warning:  An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/forums/">support forums</a>. (WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.) in C:\inetpub\WP5_GC_2021_01\wp-includes\update.php on line 751

Looking at the code the error is really the same error in code that has been duplicated:

if ( $ssl && is_wp_error( $response ) ) {
  trigger_error(
    sprintf(
      /* translators: %s: Support forums URL. */
      __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
      __( 'https://wordpress.org/support/forums/' )
    ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ),
    headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE   // <-- error here line 224
  );
  $response = wp_remote_post( $http_url, $options );
}
...
if ( $ssl && is_wp_error( $raw_response ) ) {
  trigger_error(
    sprintf(
      /* translators: %s: Support forums URL. */
      __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
      __( 'https://wordpress.org/support/forums/' )
    ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ),
    headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE   // <-- error here line 462
  );
  $raw_response = wp_remote_post( $http_url, $options );
}
...
if ( $ssl && is_wp_error( $raw_response ) ) {
  trigger_error(
    sprintf(
      /* translators: %s: Support forums URL. */
      __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
    __( 'https://wordpress.org/support/forums/' )
    ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ),
    headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE   // <-- error here line 751
  );
  $raw_response = wp_remote_post( $http_url, $options );
}

Unfortunately, I don't have a solution for this one. I'd have to dig deeper into the code. In reality, I don't know how to read that line of code.

PHuhn avatar Jun 03 '23 17:06 PHuhn

Add parenthesis : (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE

marypeng1020 avatar Aug 21 '23 22:08 marypeng1020