jDownloads Support Forum

Older Versions => jDownloads 3.2 (Support ended) => Bugs => Topic started by: Makulia on 12.11.2015 12:27:14

Title: Error! Not possible to create the zip file on PHP 5.6! - [Fixed in 3.2.42]
Post by: Makulia on 12.11.2015 12:27:14
Hello people!

I have faced the same bug that other people had reported before:
Quote"Error! Not possible to create the zip file.
Please contact the Webmaster."

I have read this topics and there were no real solution:
http://www.jdownloads.com/index.php/support-forum.html?topic=7480.0
http://www.jdownloads.com/index.php/support-forum.html?topic=7270.0

I have to debug Jdownloads and have found something interesting:

Warning: ZipArchive::addFile(): Invalid or uninitialized Zip object in /public_html/components/com_jdownloads/helpers/jdownloadshelper.php on line 1964

Warning: ZipArchive::addFile(): Invalid or uninitialized Zip object in /public_html/components/com_jdownloads/helpers/jdownloadshelper.php on line 1964

Warning: ZipArchive::addFile(): Invalid or uninitialized Zip object in /public_html/components/com_jdownloads/helpers/jdownloadshelper.php on line 1964

Warning: ZipArchive::close(): Invalid or uninitialized Zip object in /public_html/components/com_jdownloads/helpers/jdownloadshelper.php on line 1968


Problematic code:
$result = $zip->open($destination, $overwrite ? ZIPARCHIVE::OVERWRITE : ZIPARCHIVE::CREATE);
It works only with php 5.5.x and, maybe, earlier.

My quick fix for this issue for PHP 5.6 is:
$result = $zip->open($destination, ZipArchive::CREATE | ZipArchive::OVERWRITE);





Title: Re: Error! Not possible to create the zip file on PHP 5.6!
Post by: Arno on 12.11.2015 12:40:29
Hi Alexander,
many thanks for the hints. Can you give me a link to your source?
Title: Re: Error! Not possible to create the zip file on PHP 5.6!
Post by: Makulia on 17.11.2015 20:56:02
Thank you Arno.
I have attached source file.

[gelöscht durch Administrator]
Title: Re: Error! Not possible to create the zip file on PHP 5.6!
Post by: Arno on 19.11.2015 13:41:54
Quote from: Makulia on 17.11.2015 20:56:02
Thank you Arno.
I have attached source file.
Thanks for the file but i had meant the information source.
Quote
My quick fix for this issue for PHP 5.6 is:
$result = $zip->open($destination, ZipArchive::CREATE | ZipArchive::OVERWRITE);
I need an info whether this fix works for all php versions.  ::)
Title: Re: Error! Not possible to create the zip file on PHP 5.6!
Post by: Makulia on 20.11.2015 11:09:26
I have tested fix for php 5.3.x, 5.4.x, 5.5.x, 5.6.x. Works with all versions.
Information source: http://php.net/manual/en/ziparchive.open.php
Title: Re: Error! Not possible to create the zip file on PHP 5.6!
Post by: Arno on 20.11.2015 12:22:29
Okay, then i will fix it as you have described.
Title: Re: Error! Not possible to create the zip file on PHP 5.6! - [Fixed in 3.2.42]
Post by: Arno on 04.04.2016 12:38:50
The bugfix is now a part from version 3.2.42 as i had forgotten to implement it in 3.2.41.
Sorry.  ::)