Make WordPress Core

Opened 6 weeks ago

Closed 5 weeks ago

#63102 closed defect (bug) (fixed)

Remove extra slashes when concatenating ABSPATH with a path, take 2

Reported by: sergeybiryukov's profile SergeyBiryukov Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 6.8 Priority: low
Severity: minor Version:
Component: General Keywords: good-first-bug has-patch
Focuses: coding-standards Cc:

Description

Previously: [54872] / #57074.

There are a few of these lines in core:

require_once ABSPATH . '/wp-admin/includes/file.php';
...
require_once ABSPATH . '/wp-admin/includes/plugin.php';

For consistency with the rest of core, the slash before wp-admin can be removed:

require_once ABSPATH . 'wp-admin/includes/file.php';
...
require_once ABSPATH . 'wp-admin/includes/plugin.php';

as ABSPATH already includes a trailing slash.

Change History (2)

This ticket was mentioned in PR #8518 on WordPress/wordpress-develop by @dhruvik18.


5 weeks ago
#1

  • Keywords has-patch added; needs-patch removed

This PR removes the leading slash from paths that are concatenated with ABSPATH. Since ABSPATH already includes a trailing slash, adding another slash creates unnecessary double slashes and is inconsistent with most of the WordPress core.

Trac ticket: https://core.trac.wordpress.org/ticket/63102

#2 @SergeyBiryukov
5 weeks ago

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

In 60034:

Coding Standards: Remove extra slashes when concatenating ABSPATH with a path.

Since ABSPATH is defined and documented to end with a forward slash /, this changeset removes the first / from strings appended to ABSPATH in various files, leading to // in the resulting path.

Follow-up to [54872], [55720], [57545].

Props dhruvik18, SergeyBiryukov.
Fixes #63102.

Note: See TracTickets for help on using tickets.