Jump to content
View in the app

A better way to browse. Learn more.

The Uniform Server Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

php's zip_archive class writes corrupt files in Coral 8.5.5

Featured Replies

Hey all,

 

I have a utility function using the zip_archive class that makes directories into zip files. (I've put a copy at the bottom of this post.) Not sure when this broke, because when I wrote and testing the function under a previous version of Coral, it worked fine. Now, however, the zip files created do not uncompress into their contents, but uncompress into another zip file - endlessly, over and over again.

 

Maybe something else is broken, like the unzipping utility built into OSX. If you know of anything like that, please chime in!

 

Anyway, I'm perfectly fine continuing with Coral 8.5.5 unless there's some good reason to upgrade. I've got a product launch in about 4 weeks, and don't really have the time to troubleshoot things going wrong with an upgrade to Coral, unless something important like bug fixes to the zip_archive class are in the upgrade.

 

Thanks for any information you can offer!

 

/*********************************************************************************
* recursive zip directory add, just pass in the path to a directory as 'src' and
* it's recursive contents are added to the zip archive created at 'destination' */
function _cgrn_front_zipDirectory($source, $destination) {
if (!file_exists($source)) {
   _devReport( '_cgrn_front_zipDirectory: source "'.$source.'" does not exist!' );
   return false;
}

$zip = new ZipArchive();
if (!$zip->open($destination, ZIPARCHIVE::CREATE)) {
   _devReport( '_cgrn_front_zipDirectory: failed to create zip at "'.$destination.'"!' );
   return false;
}

$source = str_replace('\\', '/', realpath($source));

if (is_dir($source) === true)
{
	$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source), RecursiveIteratorIterator::SELF_FIRST);

	foreach ($files as $file)
	{
		$file = str_replace('\\', '/', realpath($file));

		if (is_dir($file) === true)
		{
			$zip->addEmptyDir(str_replace($source . '/', '', $file . '/'));
		}
		else if (is_file($file) === true)
		{
			$zip->addFromString(str_replace($source . '/', '', $file), file_get_contents($file));
		}
	}
}
else if (is_file($source) === true)
{
	$zip->addFromString(basename($source), file_get_contents($source));
}

return $zip->close();
}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.