Make WordPress Core

Opened 9 months ago

Closed 9 months ago

Last modified 9 months ago

#59842 closed defect (bug) (fixed)

WordPress 6.4 wp_remote_get (cURL error 28: Operation timed out)

Reported by: cenkdemir's profile cenkdemir Owned by: desrosj's profile desrosj
Milestone: 6.4.1 Priority: normal
Severity: critical Version: 6.4
Component: General Keywords: has-patch dev-reviewed commit
Focuses: Cc:

Description (last modified by sabernhardt)

Hello,

WordPress 6.4 update caused wp_remote_get to give "cURL error 28: Operation timed out" errors.

I tested on two fresh WordPress installations.

How to reproduce:

functions.php:

$request = wp_remote_get( 'https://example.com/test.json' );
var_dump($request);

WordPress 6.4:

object(WP_Error)#4571 (3) { ["errors"]=> array(1) { ["http_request_failed"]=> array(1) { [0]=> string(95) "cURL error 28: Operation timed out after 5001 milliseconds with 2050 out of 2766 bytes received" } } ["error_data"]=> array(0) { } ["additional_data":protected]=> array(0) { } } 

WordPress 6.3.2:
valid json data in 1 sec

PHP 7.4

Change History (18)

#1 @cenkdemir
9 months ago

More info:

If the json file is bigger than 2050 bytes:
cURL error 28: Operation timed out after 5001 milliseconds with 2050 out of 2051 bytes received

Last edited 9 months ago by cenkdemir (previous) (diff)

#2 @nexflaszlo
9 months ago

  • Keywords has-patch added
  • Severity changed from normal to critical
  • Version set to 6.4

This issue should be critical. 6.4 updated the Requests library version which included a breaking change for anyone running on a host with curl version 7.29 (at least).

See https://github.com/WordPress/Requests/issues/838

Last edited 9 months ago by nexflaszlo (previous) (diff)

#3 @schlessera
9 months ago

Copied from https://github.com/WordPress/Requests/issues/838#issuecomment-1802386711:

Given the impact, this should be hotfixed right away in WP Core (not waiting for a Requests release) and then we need to talk to the WP systems team to see how we can get that hotfix onto the running systems. I assume that this might be something that can be fixed at the server level for api.wordpress.org.

This ticket was mentioned in Slack in #core-upgrade-install by pbiron. View the logs.


9 months ago

This ticket was mentioned in Slack in #meta by hellofromtonya. View the logs.


9 months ago

This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.


9 months ago

#7 @cenkdemir
9 months ago

*BACKUP FIRST*

If you need to bulk update Curl.php for multiple WordPress instances:

fix_wp_curl.sh:

#!/bin/bash

# Define the pattern to search for and the replacement string
search_for="if (\$this->version < self::CURL_7_22_0 && !isset(\$headers\['Connection'\])) {"
replace_with="if (!isset(\$headers['Connection'])) {"

# Define the path to the Curl.php files relative to the WordPress installations
relative_path="wp-includes/Requests/src/Transport/Curl.php"

# Find all Curl.php files under the specified directory
# Usually, WordPress installations are under /var/www/vhosts/ in Plesk
find /var/www/vhosts/ -type f -name "Curl.php" | while read file; do
    # Check if the file contains the string we want to replace
    if grep -q "$search_for" "$file"; then
        # Take a backup of the original file
        cp "$file" "$file.bak"
        
        # Replace the string
        sed -i "s/$search_for/$replace_with/" "$file"
        
        # Output the file path that was changed
        echo "Modified: $file"
    else
        # Output the file path that was not changed because the pattern was not found
        echo "Pattern not found, not modified: $file"
    fi
done

# Script complete message
echo "All matching instances have been updated."

#8 @hellofromTonya
9 months ago

  • Milestone changed from Awaiting Review to 6.4.1

Moving into 6.4.1.

Currently being discussed in Make/Core slack #core channel.

#9 @sabernhardt
9 months ago

  • Description modified (diff)

#11 @desrosj
9 months ago

  • Owner set to desrosj
  • Resolution set to fixed
  • Status changed from new to closed

In 57086:

External Libraries: Update Requests to 2.0.9.

This updates the Requests library from version 2.0.8 to 2.0.9. This is a hotfix release.

Props jorbin, hellofromTonya, desrosj, barry, cenkdemir, nexflaszlo, schlessera, jrf, Clorith, tomsommer, azaozz, pbiron, afragen, howdy_mcgee.
Fixes #59842.

#12 @jorbin
9 months ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopen for backport considersation

#13 @jorbin
9 months ago

  • Keywords dev-reviewed added

#14 @azaozz
9 months ago

  • Keywords commit added

+1 to backport too.

#15 @jorbin
9 months ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 57088:

External Libraries: Update Requests to 2.0.9.

This updates the Requests library from version 2.0.8 to 2.0.9. This is a hotfix release.

Reviewed by jorbin, desrosj.
Merges [57086] to 6.4 branch.

Props jorbin, hellofromTonya, desrosj, barry, cenkdemir, nexflaszlo, schlessera, jrf, Clorith, tomsommer, azaozz, pbiron, afragen, howdy_mcgee.
Fixes #59842.

This ticket was mentioned in Slack in #core by jorbin. View the logs.


9 months ago

#17 @jorbin
9 months ago

#59848 was marked as a duplicate.

This ticket was mentioned in Slack in #core by desrosj. View the logs.


9 months ago

Note: See TracTickets for help on using tickets.