PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » File Formats » File_Archive » Bug #4376

Zip archive wont add files or even download, zero bytes

Details

Submitted2005-05-18 08:51 UTC
Fromspam at electroteque dot org
StatusNo Feedback
PackageFile_Archive
PHP Version5.0.3
OSOSX 10.3.9
Roadmaps(Not assigned)

Comments

[2005-05-18 08:51 UTC] spam at electroteque dot org

Description:
------------
From the examples, and example code sent, I still cant
get a zip archive generated on the fly and output to the
browser to be downloaded. I have tried both toOutput and
toFiles but both return a 0 byte zip file. I tested this
on the pc and I get no output at all !

Now it would be nice for something as complicated as
this package to have more fuller docs or work on first
go :)

Reproduce code:
---------------
$source = File_Archive::readMulti(array(
File_Archive::read('clientfiles/php/nusoap.php'),
File_Archive::readMemory($this->_generate(), 'feedclient.php')
)
);
$source->extract(
File_Archive::toArchive(
'save.zip',
File_Archive::toOutput()
)
);

Expected result:
----------------
A zip file with both files in it that produces a
download box in the browser ?

Actual result:
--------------
O byte zip files on the Mac and no output in IE on PC.

[2005-05-18 09:27 UTC] spam at electroteque dot org

E_ALL did nothing, the file saved is completely blank. I
run MAC OSX as its my dev laptop, is there any fink
binaries i need for it to run properly ? I noticed u
need some program called file or something ? I suspect
you have something that is ignored with @ and its not
picking it up i guess :|

[2005-05-18 10:12 UTC] spam at electroteque dot org

Second example worked but when i try and read in any
file it doesnt like it. Also the second example
downloaded the feedclient file rather than a zip file.

[2005-05-18 11:15 UTC] spam at electroteque dot org

P!$!es?feedclient.phpK??P!$!es?feedclient.phpPK<1

Was my output

However this gave me no output, its in the read thingy,
should i try a full path ?

$source = File_Archive::read('some.txt');
if (PEAR::isError($source)) {
echo $source->message;
}
$error = $source->extract(
File_Archive::toArchive(
'save.zip',
File_Archive::toOutput()
)
);
if (PEAR::isError($error)) {
echo $error->message;
}

[2005-05-18 11:30 UTC] spam at electroteque dot org

Interesting get a load of this, this worked dude. Phew
I'll use this workaround for a while as its extended my
project a little :|

function _generate() { return "foo"; }

$string = file_get_contents('clientfiles/php/
nusoap.php');
$source = File_Archive::readMulti(array(
//File_Archive::read('clientfiles/php/nusoap.php'),
File_Archive::readMemory($string, 'nusoap.php'),
File_Archive::readMemory(_generate(),
'feedclient.php')
)
);
if (PEAR::isError($source)) {
echo "Error in read: ".$source->message;
exit(0);
}
$error = $source->extract(
File_Archive::toArchive(
'save.zip',
File_Archive::toOutput()
)
);
if (PEAR::isError($error)) {
echo "Error in extract: ".$error->message;
}

[2005-05-18 11:46 UTC] spam at electroteque dot org

I already did that, handle var was NULL :) I suspect
thats it ? I mine looked exactly like yours.