? ? ? Pending

User tests: Successful: Unsuccessful:

avatar SharkyKZ
SharkyKZ
15 Sep 2020

Summary of Changes

Fix JFile::getExt() when path contains period and file has no extension

Testing Instructions

Pass filename without extension but with path containing a period to JFile::getExt(), e.g.

JFile::getExt('C:/wamp/www/joomla.cms/somefile')

Actual result BEFORE applying this Pull Request

cms/somefile

Expected result AFTER applying this Pull Request

Empty string.

Documentation Changes Required

No.

avatar SharkyKZ SharkyKZ - open - 15 Sep 2020
avatar SharkyKZ SharkyKZ - change - 15 Sep 2020
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 15 Sep 2020
Category Libraries Unit Tests
avatar SharkyKZ SharkyKZ - change - 15 Sep 2020
The description was changed
avatar SharkyKZ SharkyKZ - edited - 15 Sep 2020
avatar SharkyKZ SharkyKZ - change - 15 Sep 2020
Labels Added: ? ?
avatar SharkyKZ SharkyKZ - change - 15 Sep 2020
Labels Added: ?
Removed: ?
avatar richard67 richard67 - test_item - 19 Sep 2020 - Tested successfully
avatar richard67
richard67 - comment - 19 Sep 2020

I have tested this item successfully on 77493bd


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

avatar Fedik Fedik - test_item - 19 Sep 2020 - Tested successfully
avatar Fedik
Fedik - comment - 19 Sep 2020

I have tested this item successfully on 77493bd


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

avatar richard67 richard67 - change - 19 Sep 2020
Status Pending Ready to Commit
avatar richard67
richard67 - comment - 19 Sep 2020

RTC


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

avatar HLeithner
HLeithner - comment - 19 Sep 2020

The assumption is wrong:
-rw-r--r-- 1 root root 0 Sep 19 17:13 filewith.extentionand\behindit

This is a valid file name on posix systems...

better way maybe to use basename() before extracting the extension.

avatar Fedik
Fedik - comment - 19 Sep 2020

This is a valid file name on posix systems

interesting, I did not knew

avatar Fedik
Fedik - comment - 19 Sep 2020

seems the bot also thinks differently ?

avatar SharkyKZ SharkyKZ - change - 19 Sep 2020
Status Ready to Commit Pending
avatar SharkyKZ
SharkyKZ - comment - 19 Sep 2020

Set back to Pending.


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

avatar SharkyKZ SharkyKZ - change - 20 Sep 2020
Labels Removed: ?
avatar richard67
richard67 - comment - 20 Sep 2020

@SharkyKZ I'm not sure if I like the pathinfo thing. I prefer to see what is expected when reading the test. But maybe that's just my taste. Other changes look good to me.

avatar HLeithner
HLeithner - comment - 20 Sep 2020

The code looks really ugly but ok.

Whats the reason not to use pahinfo for extension extraction? Performance?

And if so please add a comment that this is the reason.

avatar SharkyKZ
SharkyKZ - comment - 20 Sep 2020

Yes, performance. But whatever maintainers decide. PR #18030 using pathinfo() has been sitting open for a while.

As a compromise between performance, readability and reliability we could use SplFileInfo::getExtension().

avatar richard67
richard67 - comment - 20 Sep 2020

@SharkyKZ It's one thing if we use it in the CMS code. I would be ok with that. It's another thing if we should use it in the test, too.

avatar richard67 richard67 - test_item - 20 Sep 2020 - Tested successfully
avatar richard67
richard67 - comment - 20 Sep 2020

I have tested this item successfully on 263bfcc

PR does what it claims to do.
I'm not a fan of using pathinfo in the test because before that change, I could see the hard-coded expected result.
But that's maybe just a matter of taste.
I've tested that the expected result is equal to the extension provided by pathinfo for all cases handled by the new test and a few more.


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

avatar HLeithner
HLeithner - comment - 20 Sep 2020

I'm happy with the tests and that you use phpinfo so we know at least that we do the same then php.

Could you just add the comment about performance into the code and get a second test then I will merge it.

avatar SharkyKZ SharkyKZ - change - 20 Sep 2020
Labels Added: ?
avatar richard67
richard67 - comment - 22 Sep 2020

Last change was bigger so my previous test isn't valid anymore.

@SharkyKZ Do you know where I can see in drone or appveyor if the new tests added by this PR have run?

avatar SharkyKZ
SharkyKZ - comment - 23 Sep 2020

No idea.

avatar richard67
richard67 - comment - 23 Sep 2020

@HLeithner Are the tests ok now after the last change?

I don't really understand how it works. It adds a new data provider and a new test routine. But I don't see anything being added where those are called. Does that happen automatically, i.e. the test goes through test PHP files and scans for test routines and corresponding data provides, if any, according to a pre-defined naming scheme to collect which tests to run with which data?

And is there a place in logs here where I can see that they have run? Or do I have to run them in my local environment to verify that?

avatar HLeithner
HLeithner - comment - 23 Sep 2020

@SharkyKZ can you please add the comment why you used this instead of pathinfo to the code (we need much more of such comments) before the next person comes and want to change it to pathinfo

@richard67 we need a second test again maybe from @Fedik ?

The tests are executed automatically based on the name (iirc starting with test*), phpunit executes the data provider and iterates over the returned array and executes the test function with the value.

avatar SharkyKZ SharkyKZ - change - 23 Sep 2020
Labels Added: ?
Removed: ?
avatar SharkyKZ
SharkyKZ - comment - 23 Sep 2020

Added comment.

avatar Fedik Fedik - test_item - 23 Sep 2020 - Tested successfully
avatar Fedik
Fedik - comment - 23 Sep 2020

I have tested this item successfully on eeb2187


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

avatar richard67 richard67 - test_item - 23 Sep 2020 - Tested successfully
avatar richard67
richard67 - comment - 23 Sep 2020

I have tested this item successfully on eeb2187


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

avatar richard67 richard67 - change - 23 Sep 2020
Status Pending Ready to Commit
avatar richard67
richard67 - comment - 23 Sep 2020

RTC


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

avatar richard67
richard67 - comment - 23 Sep 2020

@HLeithner Ready for merge.

avatar HLeithner HLeithner - change - 23 Sep 2020
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2020-09-23 13:56:59
Closed_By HLeithner
Labels Added: ? ?
Removed: ?
avatar HLeithner HLeithner - close - 23 Sep 2020
avatar HLeithner HLeithner - merge - 23 Sep 2020
avatar HLeithner
HLeithner - comment - 23 Sep 2020

Thanks

Add a Comment

Login with GitHub to post a comment