WordPress.org

Make WordPress Core

#50085 closed enhancement (maybelater)

Use `__DIR__` magic constant instead of `dirname(__FILE__)`

Reported by: ayeshrajans Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch
Focuses: performance Cc:

Description

Now with WordPress requiring PHP 5.6 the minimum, we can replace dirname(__FILE__) calls with the PHP 5.3-introuced __DIR__ constant.

This ticket does not intend to change such calls in third party libraries, even on the ones that we are the de-facto maintainers due to the package age.

Attachments (1)

50085.patch (1.3 KB) - added by ayeshrajans 12 months ago.

Download all attachments as: .zip

Change History (3)

@ayeshrajans
12 months ago

#1 @SergeyBiryukov
12 months ago

  • Keywords close added

Thanks for the patch!

class-requests.php is a part of the Requests external library, any changes should be submitted upstream.

The change in wp-tests-config-sample.php was previously reverted in [47201] to avoid breaking unit tests created with WP-CLI scaffold command, see comment:15:ticket:48082 and #49377 for details.

#2 @desrosj
11 months ago

  • Keywords close removed
  • Milestone Awaiting Review deleted
  • Resolution set to maybelater
  • Status changed from new to closed
  • Version trunk deleted

Going to close this one out in favor of submitting the changes upstream to the Requests library.

If in the future updating wp-tests-config-sample.php becomes possible without the backwards compatibility problems, this can be reopened or a new ticket can be created.

Note: See TracTickets for help on using tickets.