fix problem with assumedly broken ZipArchives with OpenOffice Documents used with ZipArchive on SLES11; try opening the archive anyway, even if the onening with CHECKCONS failes. Report that to error_log, and try to proceed before failing fataly

This commit is contained in:
Klaus Leithoff 2011-01-13 10:57:20 +00:00
parent 0efb958fa1
commit 85ec9e5a53

View File

@ -694,7 +694,11 @@ abstract class bo_merge
if (isset($archive))
{
$zip = new ZipArchive;
if ($zip->open($archive,ZIPARCHIVE::CHECKCONS) !== true) throw new Exception("!ZipArchive::open('$archive',ZIPARCHIVE::OVERWRITE)");
if ($zip->open($archive,ZIPARCHIVE::CHECKCONS) !== true)
{
error_log(__METHOD__.__LINE__." !ZipArchive::open('$archive',ZIPARCHIVE::CHECKCONS) failed. Trying open without validating");
if ($zip->open($archive) !== true) throw new Exception("!ZipArchive::open('$archive',|ZIPARCHIVE::CHECKCONS)");
}
if ($zip->addFromString($content_file,$merged) !== true) throw new Exception("!ZipArchive::addFromString('$content_file',\$merged)");
if ($zip->close() !== true) throw new Exception("!ZipArchive::close()");
unset($zip);