Make WordPress Core

Opened 5 years ago

Last modified 12 months ago

#17397 reopened defect (bug)

Inconsistency in allowed site addresses

Reported by: johnbillion Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 3.0
Component: Networks and Sites Keywords: needs-patch
Focuses: multisite Cc:


The rules for allowed characters in a site address differ between when you add a new site and when you edit an existing site.

Steps to reproduce:

  1. Go to Network Admin -> Sites -> Add New
  2. Enter foo.bar as the site address and hit save. The address will be rejected as containing invalid characters.
  3. Edit an existing site instead, and enter foo.bar.yourdomain.com as the domain. The address will be accepted just fine.

Having written that out, maybe this isn't a valid bug because when adding a site you're entering the site address, but when you're editing a site you're editing the complete domain name. Hmm. I'll open it anyway and see what people think.

My core issue is that I'd like to be able to add sites that use fourth-level subdomains (eg foo.bar.baz.com when the main site is at baz.com). Currently I have to enter a different site address then go in and edit it to the desired domain.

Attachments (1)

17397.diff (622 bytes) - added by tlovett1 2 years ago.
Remove domain checks in network/site-new.php

Download all attachments as: .zip

Change History (18)

#1 @johnbillion
4 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

Gonna close this as a dupe of #17948 where this issue is covered and being worked on by wpdavis.

#2 follow-up: @SergeyBiryukov
4 years ago

Is it actually covered by that ticket? Overhaul of the signup process sounds like a different thing to me.

#3 @johnbillion
4 years ago

  • Resolution duplicate deleted
  • Status changed from closed to reopened

#4 in reply to: ↑ 2 @johnbillion
4 years ago

Replying to SergeyBiryukov:

Is it actually covered by that ticket? Overhaul of the signup process sounds like a different thing to me.

Whoops. I read this comment which covers username restrictions while I was thinking about site name restrictions.

#5 @wpmuguru
3 years ago

  • Keywords needs-patch added; 2nd-opinion removed

There is a legitimate use case for Super admins adding subdomains with one or more '.' as long as they are not two together.

#6 @Ipstenu
2 years ago

Do we want non super admins doing this, though? Yes, it's a pain to do it the way we have to (i.e. add foo1bar and change it to foo.bar) but is this a bad restriction? A super admin would (should) know if that's going to work as desired anyway.

Since the capes can do this, I'm leaning towards #wontfix or perhaps a better error 'That is an invalid name. Only superadmins can create sub-sub domains.'

Version 0, edited 2 years ago by Ipstenu (next)

2 years ago

Remove domain checks in network/site-new.php

#7 @tlovett1
2 years ago

Ticket #20019 is regarding frontend signups. This ticket is regarding super admins creating/editing sites. The same rules should apply to super admins when creating/editing sites. There are no restrictions on site addresses in the editing process, but there are during creation. My patch removes the restrictions on domain during site creation.

#8 @tlovett1
2 years ago

  • Cc admin@… added
  • Keywords has-patch added; needs-patch removed

#9 @SergeyBiryukov
2 years ago

Introduced in [13630] (for #11777). Related: [18473] (for #15554).

#10 @jeremyfelt
2 years ago

  • Milestone changed from Awaiting Review to 3.7

#11 @SergeyBiryukov
2 years ago

  • Version changed from 3.1 to 3.0

#12 @jeremyfelt
2 years ago

  • Severity changed from minor to normal

Right now, updating a site through site-info.php does only strtolower() on the domain before sending it to be updated.

Adding a site through site-new.php restricts it to [a-zA-Z0-9-]. We could cheat a bit and make that [a-zA-Z0-9-.] for now, just to allow for . to be entered on new sites, though we'd still be ignoring a bunch of valid characters for domains.

I think @tlovett1's 17397.diff is likely the right answer here until something like #17948 is used to revamp the experience entirely. It applies cleanly on trunk at the moment.

Last edited 2 years ago by SergeyBiryukov (previous) (diff)

#13 @johnbillion
2 years ago

  • Milestone changed from 3.7 to 3.8

Moving to 3.8 for discussion. We need to decide whether this needs to align with #20019.

#14 @nacin
2 years ago

  • Milestone changed from 3.8 to Future Release

#15 @jeremyfelt
22 months ago

  • Component changed from Multisite to Networks and Sites
  • Focuses multisite added

#16 @jeremyfelt
15 months ago

  • Keywords needs-patch added; has-patch removed
  • Milestone changed from Future Release to 4.1

On a revisit... While #17948 is a big effort, it seems more oriented around our Open Network concept. Adding sites through site-new.php is very much a Closed Network operation, IMO.

I'm not sure that we need to change the default validation yet, as allowing multilevel subdomains and paths without being setup for it may not be desirable.

I do think we can at least add a filter in 4.1 to help extend validation. It may even be worth starting to think about validate_site_sub_domain() and validate_site_path() functions that can be used here and in other areas like site-info.php.

Related #19724, #15831, #20019, #13387, and #18777 (effectively the sub-directory sibling of this ticket)

#17 @johnbillion
12 months ago

  • Milestone changed from 4.1 to Future Release

After our multisite chat on Tuesday, this needs a bit more thought (as per the above).

Note: See TracTickets for help on using tickets.