New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace dirname(__FILE__) with __DIR__ #14269
Conversation
Please revert the changes in these files.
|
@mbabker: No problem; I hadn't spotted restore.php as being third-party, but fair enough. Happy to revert, but can you confirm the latter before I do so? Thanks :) |
PHP will parse the entire file before executing it, it doesn't parse it line by line. We should've not changed to using |
Okay. I've reverted it. :) |
Looks fine to me. Whomever merges this, please merge to staging instead of the 3.8 branch. Don't see any reason why it should only apply there. |
@mbabker me'n thomas just undid all that a year or so ago. Why are we bringing it back? |
Bringing what back? |
if you recall starting around 1.7 we removed DIR from all of J!.. was a HUGE undertaking and didn't go smoothly. Why are we reverting? |
The |
ah, thats right.. ok.. sorry for confusion 👎 |
Not able to apply this PR, please see attached screen-shot. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/14269. |
Confirming @RonakParmar Comment. |
Looks like @Spudley deleted his repository so the fork is no longer present for you to apply using patchtester |
@brianteeman Yes I did. Sorry about that. It was a while ago now! However the patch itself is pretty trivial. If you like I'll re-create it. I guess that'll mean submitting a new PR. |
I'm just going to merge by review. |
Thank you @Bakual. :) |
Pull Request for Issue # n/a.
Summary of Changes
This is a simple PR to replace
dirname(__FILE__)
with__DIR__
across the codebase. I excluded the vendor folder as that's third-party code, but replaced all other instances.DIR was introduced in PHP 5.3 to reduce the need for convoluted dirname(FILE) constructs.
The change is syntactically identical, but makes the code clearer - it is shorter, easier to read, and easier to understand.
It might also make things slightly quicker, it's one less function to call. But that going to be marginal at best; the real reason for doing this is to make the code easier to work with.
Testing Instructions
This change should have zero impact on the functionality. The new code is functionally identical; just a bit shorter and neater. Testing should just be a case of making sure it still works the same.
Expected result
No change.
Actual result
No change.
Documentation Changes Required
None required.