WordPress.org

Make WordPress Core

Opened 11 months ago

Last modified 3 weeks ago

#44808 reviewing defect (bug)

Creating subsite with un-trimmed space results in "Missing or invalid site address."

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

Description

When adding a site:

http://aubrey.pw/d/2018/t96dsz13Kd.png

If the Site Address contains a space at the end (which is easily noticeable) it can result in "Missing or invalid site address.":

http://aubrey.pw/d/2018/b9zBWfACwV.png

We can improve this by sanitizing/trimming whitespace from the input.

Attachments (2)

44808.patch (518 bytes) - added by dharmin16 11 months ago.
Add domain into trim function to trim spaces if added by mistake.
44808.2.patch (766 bytes) - added by dharmin16 4 weeks ago.
Trim domain name variable before validation

Download all attachments as: .zip

Change History (6)

@dharmin16
11 months ago

Add domain into trim function to trim spaces if added by mistake.

#1 @dharmin16
11 months ago

  • Severity changed from minor to normal

#2 @jeremyfelt
4 weeks ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release
  • Version changed from 4.9.8 to 3.1

Good catch, it makes sense to trim this before validation.

@dharmin16 44808.patch looks like a good start, however the trim() should happen before validation rather than as a part of it. In the current form, the path is still saved with a space (e.g. /path-name /) in the database. This may mean using another variable to store $blog['domain'] during validation.

@dharmin16
4 weeks ago

Trim domain name variable before validation

#3 @dharmin16
4 weeks ago

Hi @jeremyfelt,

As per your advice, I've added changes. I've named the temporary variable as $raw_domain. If it's confusing, please share your suggestions.

Thanks

#4 @jeremyfelt
3 weeks ago

  • Keywords has-patch added; needs-patch removed
  • Milestone changed from Future Release to 5.3
  • Owner set to jeremyfelt
  • Status changed from new to reviewing
  • Type changed from enhancement to defect (bug)
Note: See TracTickets for help on using tickets.