Search code examples
phpgoogle-app-enginephp-ziparchive

Google app engine php zip extension


I am using Google app engine and I want to create a zip archive using the zip extension which is supported in the current version. The problem is that every time i call ZipArchive::close it returns false and ZipArchive::getStatusString returns "Failure to create temporary file: Read-only file system". I am creating the zip file in the cloud storage like this:

$zip = new ZipArchive();
$zip->open("gs://whatever/somethig.zip", ZipArchive::OVERWRITE); //returns true
$zip->addFromString('file.txt', "some random data"); //returns true
$zip->numFiles; // = 1
$zip->close(); // returns false
$zip->getStatusString(); //returns Failure to create temporary file: Read-only file system

and it should be writable, it actually is with file_set_content or whatever. I tried the same code with a couple of variations:

  1. already existing zip file;
  2. not existing zip file;
  3. ZipArchive::CREATE as a second parameter of the ZipArchive::open call
  4. Using ZipArchive::addFile to add the file from cloud storage

Maybe it tries to create a temporary file on some other place not on the cloud storage, but this thing that i'm doing is very common scenario and i doubt that this is an app engine bug, after all they claim that they support the zip extension here.

Does someone have some idea what can be the problem?

Thank you.


Solution

  • Looks like a bug - can you open an issue in the issue tracker?