WordPress.org

Make WordPress Core

#49940 closed enhancement (wontfix)

Replace dirname( __DIR__ ) with relative path

Reported by: flip101 Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Administration Keywords:
Focuses: coding-standards Cc:

Description

https://core.trac.wordpress.org/browser/trunk/src/wp-admin/user/admin.php#L12

require_once '../admin.php';

Maybe also in other parts of code

Change History (1)

#1 @SergeyBiryukov
20 months ago

  • Component changed from General to Administration
  • Focuses coding-standards added
  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Hi there, welcome to WordPress Trac! Thanks for the ticket.

Using dirname( __DIR__ ) is intentional here, see [25616] / #17092 and comment:1:ticket:37060 for more context.

Switching to a relative path would make the code rely on PHP include_path configuration, which in some scenarios can lead to including a wrong file and causing obscure issues.

Using a full path guards against that.

Note: See TracTickets for help on using tickets.