Grandt / PHPZip

PHP Class to create archives of compressed files in ZIP format.
http://www.phpclasses.org/package/6110
118 stars 21 forks source link

Problems on shared hosting PHP5.4 #21

Open Panospheric opened 10 years ago

Panospheric commented 10 years ago

Dear Grandt,

I am sorry to bother you again. I am having issues with corrupt zip files on shared hosting on PHP5.4. It creates a corrupt zip file. It seems it doesn't add the closing information to the zip file. I was able to repair the zip file and compare it to the corrupted one. They are identical except the finalizing data seems missing. I wonder if I could send you both files so you could a possible issue. It must be related to the php E_STRICT. I am also not saying that is the class causing it. 1and1 won't give me access to the apache error logs so it's hard to figure out.

Thanks in advance.

Chris

P.S. this class rocks :)

Grandt commented 10 years ago

Please send me the files, and I'll have a look, it might not be before the weekend though.

Send them to php@grandt.com

Cheers

On 20-03-2014 05:36, Panospheric wrote:

Dear Grandt,

I am sorry to bother you again. I am having issues with corrupt zip files on shared hosting on PHP5.4. It creates a corrupt zip file. It seems it doesn't add the closing information to the zip file. I was able to repair the zip file and compare it to the corrupted one. They are identical except the finalizing data seems missing. I wonder if I could send you both files so you could a possible issue. It must be related to the php E_STRICT. I am also not saying that is the class causing it. 1and1 won't give me access to the apache error logs so it's hard to figure out.

Thanks in advance.

Chris

P.S. this class rocks :)

— Reply to this email directly or view it on GitHub https://github.com/Grandt/PHPZip/issues/21.

Panospheric commented 10 years ago

Thanks a lot Grandt. Just sent the files.

Chris

Panospheric commented 10 years ago

I had to modify to code a bit a defined both set_error_handler("errorHandler") and register_shutdown_function("shutdownHandler") and saved any errors to a log file. That seemed to be working quite well and I was able to eliminate any E_STRICT errors. To my surprise, after eliminating all errors, the zip file is still corrupt towards the end for some odd reason. Again, I only have this issue on PHP5.4 on 1and1.com hosting.

Any other inspirations?

Thanks again.

Best regards,

Chris

Grandt commented 10 years ago

I'd love to see what phpinfo(); returns on 1and1.

Create a file with

<?php
    phpinfo();
?>

and run it.

I just tested on my own hosted site, and it works fine in php 5.4.26, so it is something specific to 1and1's setup.

It looks like finalize() is never called, or never completes correctly.

One way to test this, is to add a zip file comment, does that show up at the end of the corrupt file? Another test is to see if you can add another entry to the file after you have called finalize(), but before sending the zip file. ie.

$zip->addFile("Hello end of the World!", "helloEnd.txt");

Those two tests may help me narrow down the issue.

Panospheric commented 10 years ago

Thanks for you help Grandt.

I did try to add a comment and the extra txt file but it doesn't seem it got added.

I sent you the link to the php info.

Thanks again,

Best regards,

Chris