PR-4.4-dev Pending

User tests: Successful: Unsuccessful:

avatar Hackwar
Hackwar
14 Mar 2023

Summary of Changes

In the process of deprecating the CMS Filesystem package, this PR replaces all cases of File::exists() with is_file(). File::exists() is a wrapper for is_file(Path::clean($path)), so by removing it, we are removing the Path::clean($path). However, as far as I can see, we either have a safely secure path anyway or it is already wrapped with Path::clean(). Where it isn't wrapped, it actually is hardly usefull, because we do a File::exists($path) and shortly after use the original value of $path to include that file. Long story short, I think this is a safe change.
I still would like the @joomla/security-leads to have a look at this.

Testing Instructions

After applying this, nothing should have changed. Thus, a codereview would probably make the most sense here.

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

avatar joomla-cms-bot joomla-cms-bot - change - 14 Mar 2023
Category Administration com_admin com_config com_content com_contenthistory com_installer com_joomlaupdate com_postinstall com_templates Front End Installation Libraries Plugins
avatar Hackwar Hackwar - open - 14 Mar 2023
avatar Hackwar Hackwar - change - 14 Mar 2023
Status New Pending
avatar Hackwar Hackwar - change - 14 Mar 2023
Labels Added: PR-4.4-dev
avatar Hackwar
Hackwar - comment - 14 Mar 2023

tbh I have not the feeling that you checked every call if it's save to use simple is_file now without cleaning the path.

I admit, I did not check these cases, but only checked when the variable was last written to.

avatar laoneo
laoneo - comment - 14 Mar 2023

Are there any occurrences of File::exists left in the core? If not, then I would add the deprecation message right into this pr.

avatar Hackwar
Hackwar - comment - 14 Mar 2023

No, all occurences have been handled with this. But I would really like to keep the deprecation messages in one PR, among other things because it means I only have to make one PR to the manual repository. If you want me to make 40 PRs to deprecate each method individually, then I would rather defer all that work to you.

avatar laoneo
laoneo - comment - 14 Mar 2023

You can make one pr in the manual and then reference it from each of these subsequent pr's. Would that be ok?

avatar Hackwar
Hackwar - comment - 14 Mar 2023

Not really, because it would mean that I would have to update #40111 several times for each case where a method was deprecated individually. I also would not simply close #40111, because there are several methods and whole classes which we aren't using at all in core. And it means dozens of PRs poluting our history with something being deprecated here and then something there. And if we don't get all existing code converted in time for 4.4, we wouldn't be able to remove it all in 6.0, just because deprecation is supposed to be done in time with migration of the core. I'm not saying that I wouldn't be able to write all that code in time, but considering that I'm waiting for 2.5 years now for people to test the install progress bar, I have zero confidence in that necessary PRs would be merged in time.

avatar laoneo
laoneo - comment - 14 Mar 2023

Ok, then leave it as it is.

avatar SniperSister
SniperSister - comment - 15 Mar 2023

I still would like the https://github.com/orgs/joomla/teams/security-leads to have a look at this.

Looks ok from the security side of things

avatar Hackwar
Hackwar - comment - 15 Mar 2023

All changes have been applied. Ready to test/codereview/merge. 😃

avatar laoneo laoneo - close - 15 Mar 2023
avatar laoneo laoneo - merge - 15 Mar 2023
avatar laoneo laoneo - change - 15 Mar 2023
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2023-03-15 16:25:22
Closed_By laoneo
avatar laoneo
laoneo - comment - 15 Mar 2023

Thanks!

Add a Comment

Login with GitHub to post a comment