Implemented Call to undefined method Joomla\Filesystem\File::getExt()
- Helmut
-
Onderwerp Auteur
- Offline
Minder
Lees meer
- Berichten: 11
- Ontvangen bedankjes 0
1 jaar 2 maanden geleden #2829
door Helmut
Call to undefined method Joomla\Filesystem\File::getExt() werd gestart door Helmut
Dit bericht bevat beveiligde informatie
Discussie gesloten.
- Ruud van Lent
-
- Offline
Minder
Lees meer
- Berichten: 1707
- Ontvangen bedankjes 111
1 jaar 2 maanden geleden #2830
door Ruud van Lent
Beantwoord door Ruud van Lent in topic Call to undefined method Joomla\Filesystem\File::getExt()
Hi Helmut, that is strange as that method is a core joomla function. it is called always the same regardless of which directory you are using as input.
Are there files in the directory without extension?
What happens when you rename the directory and configure that to be displayed?
Are there files in the directory without extension?
What happens when you rename the directory and configure that to be displayed?
Discussie gesloten.
- Helmut
-
Onderwerp Auteur
- Offline
Minder
Lees meer
- Berichten: 11
- Ontvangen bedankjes 0
1 jaar 2 maanden geleden #2831
door Helmut
Beantwoord door Helmut in topic Call to undefined method Joomla\Filesystem\File::getExt()
Hi Ruud,
yes - it's strange. I renamed the directory, but this doesn't work. I have a lot of directories with images (all of them with extension) and tested various - but none of them are working. I found out following:
In the file \plugins\system\ochglightbox\src\Helper\OchGlightboxHelper.php (Line 31):
If i address the file-method in the old way, the images are shown without problem.
I changed: Joomla\Filesystem\File
To: use Joomla\CMS\Filesystem\File
Very strange
yes - it's strange. I renamed the directory, but this doesn't work. I have a lot of directories with images (all of them with extension) and tested various - but none of them are working. I found out following:
In the file \plugins\system\ochglightbox\src\Helper\OchGlightboxHelper.php (Line 31):
If i address the file-method in the old way, the images are shown without problem.
I changed: Joomla\Filesystem\File
To: use Joomla\CMS\Filesystem\File
Very strange
Discussie gesloten.
- Ruud van Lent
-
- Offline
Minder
Lees meer
- Berichten: 1707
- Ontvangen bedankjes 111
1 jaar 2 maanden geleden #2832
door Ruud van Lent
Beantwoord door Ruud van Lent in topic Call to undefined method Joomla\Filesystem\File::getExt()
Hi Helmut,
the old one is deprecated in 4.4 and will be removed in 6.0. The documentation explicitly says to use the new one:
But investigating learns that the replacement class doesn´t have the getExt() function, so replacing it as instructed can (and in your case will) lead to issues.
In the private message tab I have added a download link to a test version where I replace the getExt() function with a PHP equivalent (so not depending on Joomla class).
Can you test if this work correct on your site (it works on my site, but I can not reproduce the issue in the first place so would be nice to have confirmation that it works and that the error is gone.
regards,
Ruud.
the old one is deprecated in 4.4 and will be removed in 6.0. The documentation explicitly says to use the new one:
Code:
/**
* A File handling class
*
* @since 1.7.0
* @deprecated 4.4 will be removed in 6.0
* Use Joomla\Filesystem\File instead.
*/
But investigating learns that the replacement class doesn´t have the getExt() function, so replacing it as instructed can (and in your case will) lead to issues.
In the private message tab I have added a download link to a test version where I replace the getExt() function with a PHP equivalent (so not depending on Joomla class).
Can you test if this work correct on your site (it works on my site, but I can not reproduce the issue in the first place so would be nice to have confirmation that it works and that the error is gone.
regards,
Ruud.
Discussie gesloten.
- Ruud van Lent
-
- Offline
Minder
Lees meer
- Berichten: 1707
- Ontvangen bedankjes 111
1 jaar 2 maanden geleden - 1 jaar 2 maanden geleden #2833
door Ruud van Lent
Beantwoord door Ruud van Lent in topic Call to undefined method Joomla\Filesystem\File::getExt()
Also to follow up: this appears to be a J4.4 core issue. When doing a lookup for the getExt() function I get the following results for Joomla 5.0, 4.4 and 5.1:
as you can see the function is missing in 44/libraries/vendor/joomla/filesystem/src/File.php
I think the maintainers ran into this themselves and added it (back?) in 5.0 onwards, but 'forgot' to do this also in 4.4
Code:
./50/libraries/vendor/joomla/filesystem/src/File.php: public static function getExt($file)
./50/libraries/src/Filesystem/File.php: public static function getExt($file)
./44/libraries/src/Filesystem/File.php: public static function getExt($file)
./51/libraries/vendor/joomla/filesystem/src/File.php: public static function getExt($file)
./51/libraries/src/Filesystem/File.php: public static function getExt($file)
as you can see the function is missing in 44/libraries/vendor/joomla/filesystem/src/File.php
I think the maintainers ran into this themselves and added it (back?) in 5.0 onwards, but 'forgot' to do this also in 4.4
Laatst bewerkt 1 jaar 2 maanden geleden doorRuud van Lent.
Discussie gesloten.
- Helmut
-
Onderwerp Auteur
- Offline
Minder
Lees meer
- Berichten: 11
- Ontvangen bedankjes 0
1 jaar 2 maanden geleden #2834
door Helmut
Beantwoord door Helmut in topic Call to undefined method Joomla\Filesystem\File::getExt()
Hello Ruud,
i read this too ( issues.joomla.org/tracker/joomla-cms/42460)
Thanks for the dev-package - after installation all works fine!
Best regards
Helmut
i read this too ( issues.joomla.org/tracker/joomla-cms/42460)
Thanks for the dev-package - after installation all works fine!
Best regards
Helmut
Discussie gesloten.
- Ruud van Lent
-
- Offline
Minder
Lees meer
- Berichten: 1707
- Ontvangen bedankjes 111
1 jaar 2 maanden geleden #2835
door Ruud van Lent
Beantwoord door Ruud van Lent in topic Call to undefined method Joomla\Filesystem\File::getExt()
Thanks for reporting back, and issue on github is indeed what is the case: IMO it should be backported so that what they advice to do actually works 
Anyway, doing it this way also works.
Will release a new version somewhere in the next days, you can just upgrade over the test version without issues.
regards,
Ruud

Anyway, doing it this way also works.
Will release a new version somewhere in the next days, you can just upgrade over the test version without issues.
regards,
Ruud
Discussie gesloten.