[wp-trac] [WordPress Trac] #18117: get_blog_details is sensitive to path's trailing slash

WordPress Trac noreply at wordpress.org
Tue Nov 4 06:07:09 UTC 2014


#18117: get_blog_details is sensitive to path's trailing slash
----------------------------------------+------------------------
 Reporter:  mitchoyoshitaka             |       Owner:
     Type:  defect (bug)                |      Status:  new
 Priority:  normal                      |   Milestone:  4.1
Component:  Networks and Sites          |     Version:  3.0
 Severity:  normal                      |  Resolution:
 Keywords:  has-patch needs-unit-tests  |     Focuses:  multisite
----------------------------------------+------------------------
Changes (by jeremyfelt):

 * keywords:  has-patch => has-patch needs-unit-tests
 * milestone:  Future Release => 4.1


Comment:

 Rather than attempting to resolve this in one specific place - `site-
 info.php` - it makes sense to go to the root.
 [https://core.trac.wordpress.org/attachment/ticket/18117/18117.3.diff
 18117.3.diff] adds some sanitization to `update_blog_details()` for path.

 * Explode into an array on `/`, so that multiple subdirectories can be
 specified.
 * Strip all empty array elements, so that `///` doesn't cause issues.
 * Implode with `/` and add leading and trailing slashes.

 I actually think the above ''could'' be used for subdirectory validation
 at some point, but only when we're ready.

 The tests @simonwheatley added in 18117.2.diff will work, though we'll
 need to refresh them and add to the `tests/multisite/site.php` file. We
 could also think about breaking them into one test per assertion. They
 definitely should not be added to the massive list of current
 `update_blog_details()` tests.

 This would fix #23865 as well.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/18117#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list