WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#30417 closed defect (bug) (fixed)

In multisite, Siteurl and Home url break when updating path via site-info.php and leaving off a leading slash

Reported by: earnjam Owned by: jeremyfelt
Milestone: 4.2 Priority: normal
Severity: normal Version: 3.1
Component: Networks and Sites Keywords: has-patch
Focuses: multisite Cc:

Description

When updating a site using site-info.php, if you enter a path without a leading slash and have the box checked for "Update siteurl and home as well.", then it will cause home and siteurl to update to http://domain.compath and break all subpages, scripts, styles, etc.

This issue is similar to #18117 and #23865 in that it is due to the slashes not being checked, but this is a separate issue because it affects siteurl and home. Patch 18117.4.diff:ticket:18117 on #18117 appears to solve both #18117 and #23865, but does not address this particular issue. In site-info.php, siteurl and home get updated prior to running update_blog_details() so the fixes there to correct the slashes in the path don't solve this particular problem.

Attachments (2)

30417.diff (1.3 KB) - added by earnjam 5 years ago.
30417.1.diff (1.3 KB) - added by earnjam 5 years ago.

Download all attachments as: .zip

Change History (7)

@earnjam
5 years ago

#1 @earnjam
5 years ago

  • Keywords has-patch needs-testing added

Patch 30417.diff requires 18117.4.diff:ticket:18117.

It moves the updating of siteurl and home to after the call to update_blog_details() where the path slashes get cleaned up from 18117.4.diff:ticket:18117.

It then can use those newly stored domain and path values to generate the new urls to be stored in the siteurl and home options.

@earnjam
5 years ago

#2 @earnjam
5 years ago

Slight change in 30417.1.diff: I switched the $get_all parameter in the call to get_blog_details() to false because we don't need the full details, only what is in the blogs table.

#3 @jeremyfelt
5 years ago

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

In 31156:

Update home and siteurl after path slashes are validated in update_blog_details()

When editing a site, if home and siteurl are checked to be updated along with a site's domain and path, they should receive the results of any modifications in update_blog_details() rather than trusting the POST data.

Previously, it was possible to save a value without a leading slash on the path, causing an invalid URL to be stored.

Props earnjam.

Fixes #30417.

#4 @jeremyfelt
5 years ago

  • Keywords needs-testing removed
  • Milestone changed from Awaiting Review to 4.2

This ticket was mentioned in Slack in #core-multisite by nacin. View the logs.


4 years ago

Note: See TracTickets for help on using tickets.