WordPress.org

Make WordPress Core

Opened 10 months ago

Last modified 10 months ago

#40334 new defect (bug)

Trim siteurl and homeurl

Reported by: thamaraiselvam Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.7.3
Component: General Keywords:
Focuses: Cc:

Description

I have seen some sites accidently put new line or space end of the siteurl and home in the wp_options
So whenever WordPress defines constants like WP_CONTENT_URL its not trimming the siteurl
/wp-includes/default-constants.php

function wp_plugin_directory_constants() {
        if (!defined('WP_CONTENT_URL')) {
                define('WP_CONTENT_URL', get_option('siteurl') . '/wp-content');
        }

If siteurl has the new line in the end and plugin_url()

gives the result as follow

https://example.com
/wp-content/plugins/myplugin/

As javascript is not supporting multiline string so it just broke my UI.

Attachments (1)

40334.patch (662 bytes) - added by thamaraiselvam 10 months ago.
This sample patch but it should be done everywhere

Download all attachments as: .zip

Change History (3)

@thamaraiselvam
10 months ago

This sample patch but it should be done everywhere

#1 @thamaraiselvam
10 months ago

Also if siteurl and home keys has the new line or space at the end WordPress never shows any warnings or error

Note: See TracTickets for help on using tickets.