Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#57074 closed defect (bug) (fixed)

Remove extra slashes when concatenating ABSPATH with a path

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

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 4 years ago.

Download all attachments as: .zip

Change History (5)

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


4 years ago
#1

  • Keywords has-unit-tests added

#2 @audrasjb
4 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
4 years ago

  • Owner set to audrasjb
  • Resolution → fixed
  • Status new → 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.