[wp-trac] [WordPress Trac] #48082: Replace `dirname(__FILE__)` with `__DIR__` (Performance improvement, massive patch)
WordPress Trac
noreply at wordpress.org
Thu Feb 6 20:12:00 UTC 2020
#48082: Replace `dirname(__FILE__)` with `__DIR__` (Performance improvement,
massive patch)
------------------------------+--------------------------------------------
Reporter: ayeshrajans | Owner: SergeyBiryukov
Type: enhancement | Status: reopened
Priority: normal | Milestone: 5.4
Component: General | Version:
Severity: minor | Resolution:
Keywords: has-patch needs- | Focuses: performance, coding-standards
testing |
------------------------------+--------------------------------------------
Changes (by danielbachhuber):
* status: closed => reopened
* resolution: fixed =>
Comment:
Neat improvement :)
My plugin tests have started failing on trunk after this changeset with:
{{{
Warning: require_once(/tmp/wordpress-tests-lib/src//wp-includes/class-
phpmailer.php): failed to open stream: No such file or directory in /tmp
/wordpress-tests-lib/includes/mock-mailer.php on line 2
}}}
This is because `install-wp-tests.sh` (a very common bash script) uses
`sed` to modify `wp-tests-config-sample.php`: https://github.com/wp-cli
/scaffold-command/blob/838b61095fe87105456461b5c065dcf058902432/templates
/install-wp-tests.sh#L115-L118
While using `sed` to modify `wp-tests-config-sample.php` certainly isn't
the best idea in the world, it's going to be pretty painful for many
(thousands of?) plugins to update `install-wp-tests.sh` so the script
handles both WP 5.3 and WP 5.4 scenarios.
For the purposes of not causing these explosions, could we revert back to
`dirname( __FILE__ )` in `wp-tests-config-sample.php`?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/48082#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list