Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#57074 closed defect (bug) (fixed)

Remove extra slashes when concatenating ABSPATH with a path

Reported by: tobiasbg's profile TobiasBg Owned by: audrasjb's profile audrasjb
Milestone: 6.2 Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch has-unit-tests
Focuses: coding-standards Cc:

Description

Follow-up to @emanuelx's findings in #57071:

ABSPATH is defined and documented to end with a forward slash /.
In some Core files, a string that begins with a / is appended, leading to // in the resulting path.
While this usually doesn't lead to issues, it at least brings confusion.

Searching for ABSPATH . '/ and ABSPATH . "/ revealed 13 files where this happens.
The attached patch removes the extra /.

Attachments (1)

ABSPATH.patch (9.7 KB) - added by TobiasBg 2 years ago.

Download all attachments as: .zip

Change History (5)

@TobiasBg
2 years ago

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


2 years ago
#1

  • Keywords has-unit-tests added

#2 @audrasjb
2 years ago

Hello there, thanks for the ticket and the patch!

I put together a PR with your patch, just to make sure unit tests are passing.

#3 @audrasjb
2 years ago

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

In 54872:

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.

Props TobiasBg, audrasjb, SergeyBiryukov, emanuelx.
Fixes #57074.
See #57071.

Note: See TracTickets for help on using tickets.