joomla-framework / archive Goto Github PK
View Code? Open in Web Editor NEWJoomla Framework Archive Package
License: GNU General Public License v2.0
Joomla Framework Archive Package
License: GNU General Public License v2.0
libraries/joomla/archive/zip.php in joomla/joomla-cms@aadf697
Issues fixed in the CMS are backported/contributed/coordinated by the JSST with the framework packages
Reported Date: 2020-09-08
Fixed Date: 2021-03-02
Todays date 5th March 2021
Framework Still vulnerable...
$archive = new Archive;
$archive->extract( 'something.ZIP', $this->tmp_directory);
Success
Unknown archive type: ZIP
Linux/Apache/Joomla 3.9.3
If renamed to something.zip
it works.
First of all checkout https://bugs.php.net/bug.php?id=63195&edit=1
Now if you extract an bzip2 archive with use_stream option enabled then it doesn't extract file. It throws an exception.
On further checking I found out that on second iteration of reading (do-while loop) in Stream::read it got empty string and that caused exception.
Same is the case with gzip archive extraction using streams.
Something along the lines of Cannot write to file /home/example/public_html/administrator/components/com_foobar/foobar.php
The useless, if not misleading, error message Unable to write entry
Irrelevant.
The Joomla! extensions installer simply dumps the message from the RuntimeException you are throwing in the Zip and Tar classes. For example, in the ZIP class you have this code (one of two areas in the class that need to be changed):
// Make sure the destination folder exists
if (!Folder::create(dirname($path)))
{
throw new \RuntimeException('Unable to create destination');
}
if (!File::write($path, $buffer))
{
throw new \RuntimeException('Unable to write entry');
}
These are useless error messages. It'd be better if you did:
// Make sure the destination folder exists
if (!Folder::create(dirname($path)))
{
throw new \RuntimeException('Unable to create destination folder ' . dirname($path));
}
if (!File::write($path, $buffer))
{
throw new \RuntimeException('Unable to write to file ' . $path);
}
It doesn't matter if you are a developer using this class in your own code or an end user. These messages are thrown when there is a filesystem access issue. If you don't know where in the filesystem the issue is you cannot fix it. Moreover, "write entry" means exactly nothing, zero, nada, zilch to someone who ends up seeing this error message. Even worse, there is no indication it's a filesystem issue. The first thing that springs to mind is "database error".
This issue will be referenced in my documentation as Yet Another Joomla! Bug which prevents my clients from installing my extensions while making it impossible for me to support them. I can't help them if there is no indication of whether the problem is Joomla! extracting the extensions from the package ZIP or extracting an extension ZIP to the temporary folder or something else. No useful feedback from Joomla! = bug. Please fix it. I've provided the solution for your convenience.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.