Make WordPress Core

Opened 14 years ago

Closed 13 years ago

#18051 closed defect (bug) (fixed)

Automatic updates fail if PHP/Mysql versions contain spaces

Reported by: vtd's profile vtd Owned by: dd32's profile dd32
Milestone: 3.3 Priority: normal
Severity: normal Version: 3.2
Component: Upgrade/Install Keywords: has-patch
Focuses: Cc:

Description

If the URL for checking for updates includes spaces (it does if PHP version is "5.2.5 (x64)", for example), then the check for updates fails (

wp_remote_get($url, $options)

in update.php returns HTTP 400 Bad Request error, making automatic updates impossible (Wordpreess always says it's up to date). This can be fixed by processing PHP and MySQL versions with urlencode(), so the url-formation line in updater.php should look like his

$url = "http://api.wordpress.org/core/version-check/1.6/?version=".
urlencode($wp_version).
"&php=".urlencode($php_version).
"&locale=$locale&mysql=".urlencode($mysql_version).
"&local_package=$local_package&blogs=$num_blogs&users={$user_count['total_users']}&multisite_enabled=$multisite_enabled";

Attachments (1)

18051.diff (1.0 KB) - added by kurtpayne 13 years ago.

Download all attachments as: .zip

Change History (10)

#1 @scribu
14 years ago

  • Cc nacin added
  • Milestone changed from Awaiting Review to WordPress.org

#2 follow-up: @nacin
14 years ago

  • Milestone changed from WordPress.org to Awaiting Review

Not a WP.org issue - looks like the HTTP API is choking.

#3 in reply to: ↑ 2 @sterlo
14 years ago

Example:

Before:
string(171) "http://api.wordpress.org/core/version-check/1.6/?version=3.3-aortic-dissection&php=5.2.5 (x64)&locale=en_US&mysql=5.1.51&local_package=&blogs=1&users=1&multisite_enabled=0"

After:
string(175) "http://api.wordpress.org/core/version-check/1.6/?version=3.3-aortic-dissection&php=5.2.5+%28x64%29&locale=en_US&mysql=5.1.51&local_package=&blogs=1&users=1&multisite_enabled=0"

#4 follow-up: @dd32
14 years ago

Indeed the HTTP API isn't behaving like browsers, it's making the request directly with the url passed to it, whilst browsers do a bit of urlencoding over the contents if it sees anything unencoded.

the urlencode() addition here to the update check seems like the most appropriate response.

#5 @SergeyBiryukov
13 years ago

  • Keywords needs-patch added

@kurtpayne
13 years ago

#6 in reply to: ↑ 4 @kurtpayne
13 years ago

  • Cc kpayne@… added

Replying to dd32:

the urlencode() addition here to the update check seems like the most appropriate response.

Are you looking for something like 18051.diff?

#7 @dd32
13 years ago

  • Keywords has-patch added; needs-patch removed
  • Milestone changed from Awaiting Review to 3.3

#8 @dd32
13 years ago

Are you looking for something like 18051.diff

Not what I had in mind, but certainly a better option.

I had to alter it a bit however (certain servers are configured to have & as the separator, which would've broken the URL)

#9 @dd32
13 years ago

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

In [18697]:

Use http_build_query in the Core Update check to encode version numbers. Props kurtpayne. Fixes #18051

Note: See TracTickets for help on using tickets.