Lord_Helmchen VIP
Total posts: 31
23 Май 2015 15:36

Hi, i get the following error when i click on Build.

PHP Warning:  ZipArchive::addFile(): Invalid or uninitialized Zip object in /var/www/webkonto1/public_html/eisradio/administrator/components/com_cobalt/models/pack.php on line 871

The Problem must be on line 426

$zipper->open($zip_filename, ZIPARCHIVE::OVERWRITE);

When i change to

$zipper->open($zip_filename, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE);

then everything seems to be fine. I've tested this code with PHP 5.5.25 and 5.6.9. Can you confirm this?

I don't know if above code is correct, maybe we have to test if file exists before like

if (file_exists($zip_filename)) {
    $zipper->open($zip_filename, ZIPARCHIVE::OVERWRITE)
} else {
    $zipper->open($zip_filename, ZIPARCHIVE::CREATE)
}

EDIT: Some more Information. On hosteurope webhosting package with PHP 5.3 and 5.4 your original code works just fine.

Последние изменения: 27 Май 2015


Sergey
Total posts: 13,748
27 Май 2015 16:05

I updated the code. that looks like correct code.

Работает на Cobalt