Skip to content

[5.3] Replace calls to dirname(__FILE) with __DIR__#44882

Merged
rdeutz merged 1 commit intojoomla:5.3-devfrom
janschoenherr:patch-26
Feb 27, 2025
Merged

[5.3] Replace calls to dirname(__FILE) with __DIR__#44882
rdeutz merged 1 commit intojoomla:5.3-devfrom
janschoenherr:patch-26

Conversation

@janschoenherr
Copy link
Contributor

@janschoenherr janschoenherr commented Feb 13, 2025

Use the __DIR__ constant. It's shorter and doesn't require a function call.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@dgrammatiko
Copy link
Contributor

All these files are the Joomla entry points for the app. I'm not sure if this change will work with the public folder...

@janschoenherr
Copy link
Contributor Author

I don't think there is a difference. WordPress uses __DIR__ in the index.php.

Copy link
Contributor

@joomdonation joomdonation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some changes need to be reverted to make sure fatal error is not thrown when we tried to access in PHP older than 5.3 (Yes, I know it is not going to happen on real life these days, but it is states in the beginning of the file, so we better respect that rule).

@dgrammatiko
Copy link
Contributor

WordPress uses DIR in the index.php

Well, WP doesn't have an option for public folder #40509 but anyways that wasn't really the reason as @joomdonation mentioned it's about compatibility for ancient PHP versions in the app entry points

Copy link
Member

@HLeithner HLeithner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As tuan said, don't change the entry points, we don't win anything here and only loose better looking error messages for really old php versions.

@janschoenherr
Copy link
Contributor Author

I've reverted the changes in the PHP error messages.

@joomdonation
Copy link
Contributor

I have tested this item ✅ successfully on 3300441


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44882.

@komalm
Copy link

komalm commented Feb 22, 2025

I have tested this item ✅ successfully on 3300441


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44882.

@QuyTon
Copy link
Contributor

QuyTon commented Feb 23, 2025

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44882.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Feb 23, 2025
@rdeutz rdeutz merged commit 576f005 into joomla:5.3-dev Feb 27, 2025
4 checks passed
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Feb 27, 2025
@rdeutz rdeutz added this to the Joomla! 5.3.0 milestone Feb 28, 2025
janschoenherr added a commit to janschoenherr/joomla-cms that referenced this pull request Mar 10, 2025
@janschoenherr janschoenherr deleted the patch-26 branch October 15, 2025 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants