gluon Posted January 29, 2011 Share Posted January 29, 2011 hello,I have some problem with my zip.When a customer download them, the zip cannot be open directly with OS like windows, or even Mac OSX.Indeed, when I make a diff between the zip downloaded & the initial one, when the zip pass through the php zip in prestashop, it is modified.Maybe, it is "only" the webserver engine (apache, php)But I disabled gzip compression, it is all the same.Any ideas?Btw, I have also a problem with "pure" text file download.They seem to be reencoded as UTF8 and in some case it is annoying. Link to comment Share on other sites More sharing options...
Yann - Prestaplugins Posted January 29, 2011 Share Posted January 29, 2011 I have the same problem. I reported a bug in the bugtracker : http://www.prestashop.com/bug_tracker/view/7307/Maybe you should go and say you have this problem too to get it fixed maybe faster. Link to comment Share on other sites More sharing options...
gluon Posted January 29, 2011 Author Share Posted January 29, 2011 not sure it is related to prestashop... maybe the webserver.going there too by the way! Link to comment Share on other sites More sharing options...
gluon Posted January 30, 2011 Author Share Posted January 30, 2011 I found something IMPORTANT.I'm not sure the problem comes from a gzip encoding problem.I tested and commented those lines:- init.php line 12 : ob_start();- get-file.php line 261 : ob_end_flush();all the same.so I basically opened the 2 differents zip files in notepad++the corrupted one just contains an empty line at the beginning.removing it drives to change the corrupted file into a safe one!so, next step: how to remove this blank line (I mean a carriage return I guess) inside the downloaded file ??? Link to comment Share on other sites More sharing options...
Yann - Prestaplugins Posted January 30, 2011 Share Posted January 30, 2011 I think there's something with the 'rb' mode ine the fopen function...See Note there : http://php.net/manual/en/function.fopen.php Link to comment Share on other sites More sharing options...
gluon Posted January 30, 2011 Author Share Posted January 30, 2011 I tried many things.I cannot fix it.still on it now... Link to comment Share on other sites More sharing options...
gluon Posted January 30, 2011 Author Share Posted January 30, 2011 $mimeTypes in the qet-file.php file seems to be unuseful.when I upload a zip through the admin product creation interface, it creates a kind of hash name for the filenamethus, the $mimeTypes is never filled by the right mimetype.btw, replacing $mimeTypes by application/octet-stream in the header creation didn't drive to remove this blank line (but make my browser understand it is a zip, that is unuseful ) Link to comment Share on other sites More sharing options...
gluon Posted January 30, 2011 Author Share Posted January 30, 2011 no luck with that this annoying & blocking blank line is added at the beginning in ANY case.a server configuration problem? Link to comment Share on other sites More sharing options...
gluon Posted January 30, 2011 Author Share Posted January 30, 2011 tweaked, turned, changed around fgets(), around the rb option didn't change anything.I also tried to find ALL whitespace before <? and after ?> .............. nothing found.and I still have this annoying blank line !I'm near to give up :-( Link to comment Share on other sites More sharing options...
gluon Posted January 30, 2011 Author Share Posted January 30, 2011 I was just near from the truth!adding ob_end_clean(); after ob_end_flush(); in get-files.php did the trickWhat did I win? a free module. ... ? Link to comment Share on other sites More sharing options...
Yann - Prestaplugins Posted January 30, 2011 Share Posted January 30, 2011 You can get my free SMS module Give the solution in the bugtracker please. Link to comment Share on other sites More sharing options...
gluon Posted January 30, 2011 Author Share Posted January 30, 2011 did more interested by the mailchimp module, but it is not yours no?! Link to comment Share on other sites More sharing options...
Azurafiles Posted January 31, 2011 Share Posted January 31, 2011 This did not work for me (adding ob_end_clean(); after ob_end_flush(); in get-files.php did the trick)What could be the issue?Do I have to upload the files again before downloading? Link to comment Share on other sites More sharing options...
Azurafiles Posted January 31, 2011 Share Posted January 31, 2011 This is my Get File code: get-file.php Link to comment Share on other sites More sharing options...
gluon Posted January 31, 2011 Author Share Posted January 31, 2011 Where you have: header('Content-Disposition: attachment; filename="'.$filename.'"'); ob_end_flush(); $fp = fopen($file, 'rb'); you should have: header('Content-Disposition: attachment; filename="'.$filename.'"'); ob_end_flush(); ob_end_clean(); $fp = fopen($file, 'rb'); there are a lot of includes in those php files & if things are not done correctly, without ob_end_clean(); the download could be corrupted. Link to comment Share on other sites More sharing options...
Azurafiles Posted January 31, 2011 Share Posted January 31, 2011 Where you have:header('Content-Disposition: attachment; filename="'.$filename.'"'); ob_end_flush(); $fp = fopen($file, 'rb'); you should have: header('Content-Disposition: attachment; filename="'.$filename.'"'); ob_end_flush(); ob_end_clean(); $fp = fopen($file, 'rb'); there are a lot of includes in those php files & if things are not done correctly, without ob_end_clean(); the download could be corrupted. Thats just the thing. I did add ob_end_clean(); into my getfile.phpBut still does not work for me.Did you not see the ob_end_clean(); part in my getfile.php ? Link to comment Share on other sites More sharing options...
gluon Posted January 31, 2011 Author Share Posted January 31, 2011 didn't check it. Link to comment Share on other sites More sharing options...
Azurafiles Posted January 31, 2011 Share Posted January 31, 2011 well the problem is still there.I did double check it, and its just as you describe it should be, atleast that part.I know how to copy and paste a code, and that it has to be just right, and it is, so beats me why it wont work.Any tips?How goes if someone test my file on their server?in case, remember to backup yours first Link to comment Share on other sites More sharing options...
gluon Posted January 31, 2011 Author Share Posted January 31, 2011 did you send it to your server?it can be obvious but sometimes, we forget about obvious things.. Link to comment Share on other sites More sharing options...
Azurafiles Posted January 31, 2011 Share Posted January 31, 2011 Yes I did send it to my serer last night.I also made a test order, and download did fine, but unpacking the dam thing did nothing but errors.If I only upload the file as a exe file, the exe file wont start Link to comment Share on other sites More sharing options...
gluon Posted January 31, 2011 Author Share Posted January 31, 2011 did you make a diff on your two file (the initial & the other one) ? Link to comment Share on other sites More sharing options...
Azurafiles Posted January 31, 2011 Share Posted January 31, 2011 did you make a diff on your two file (the initial & the other one) ? A diff?If by that you ment checking my original file with the downloadet one, then yea, original works just fine, but as soon as I upload it, and run the downloadet version lateron, I get this problem.If not, then I am unsure what diff is.sorry, english not my main language. Link to comment Share on other sites More sharing options...
gluon Posted January 31, 2011 Author Share Posted January 31, 2011 diff is an unix command.did you try to open your two files in a text editor to compare them, especially the first line?in my case, and without the added function I did, the first line was a blank line.removing the blank line corrected the problem and thus, I understood where the cause was! Link to comment Share on other sites More sharing options...
Azurafiles Posted January 31, 2011 Share Posted January 31, 2011 yes there is a difference.should this not solve it self if I upload the file again to the servers?I did that, and no luck Link to comment Share on other sites More sharing options...
Yann - Prestaplugins Posted January 31, 2011 Share Posted January 31, 2011 I think ob_end_flush and ob_end_clean need to be done before sending the header.Someone could try ? Link to comment Share on other sites More sharing options...
gluon Posted January 31, 2011 Author Share Posted January 31, 2011 man, I did that as soon as I found the problem.It works very fine Link to comment Share on other sites More sharing options...
Azurafiles Posted January 31, 2011 Share Posted January 31, 2011 still issues here, should I downgrade?it worked fine before I upgraded Link to comment Share on other sites More sharing options...
gluon Posted January 31, 2011 Author Share Posted January 31, 2011 upgrade what?there are many reasons that could be cause this kind of problem !in my case, this was the only cause of problems. Link to comment Share on other sites More sharing options...
Azurafiles Posted January 31, 2011 Share Posted January 31, 2011 downgrade prestashop, because the problem started after I upgraded last time.have not changed any code besides the one mentioned here. Link to comment Share on other sites More sharing options...
Yann - Prestaplugins Posted January 31, 2011 Share Posted January 31, 2011 gluon, you add ob_end_clean after sending the http header.Maybe it need to be done before calling the header(...) function, so the white space is not sent anymore, not even in the header ? Link to comment Share on other sites More sharing options...
jolvil Posted January 31, 2011 Share Posted January 31, 2011 is it the same issue?http://www.prestashop.com/bug_tracker/view/7236/ Link to comment Share on other sites More sharing options...
Azurafiles Posted January 31, 2011 Share Posted January 31, 2011 jup the same, unless if there can be several reason.will give it a try, thanks Link to comment Share on other sites More sharing options...
shacker Posted January 31, 2011 Share Posted January 31, 2011 Its a bug if you use 1.3.6 version. To fix it just delete the last empty lines of those files/classes/Cart.php /classes/Currency.php /classes/Customer.php /classes/Meta.php /classes/OrderDetail.php /classes/Product.php Link to comment Share on other sites More sharing options...
Azurafiles Posted February 1, 2011 Share Posted February 1, 2011 Its a bug if you use 1.3.6 version. To fix it just delete the last empty lines of those files/classes/Cart.php /classes/Currency.php /classes/Customer.php /classes/Meta.php /classes/OrderDetail.php /classes/Product.php You my friend are a champion to say the least.I have been in dispair because of this issue here.Not so easy when you know almost next to nothing about stuff like this.It now works like a charm Link to comment Share on other sites More sharing options...
shacker Posted February 1, 2011 Share Posted February 1, 2011 your welcome buddy. Link to comment Share on other sites More sharing options...
What-no Posted February 4, 2011 Share Posted February 4, 2011 Its a bug if you use 1.3.6 version. To fix it just delete the last empty lines of those files/classes/Cart.php /classes/Currency.php /classes/Customer.php /classes/Meta.php /classes/OrderDetail.php /classes/Product.php Perfect, Solved my problem for downloading virtual product (photos) in 1.3.6.To solve the lack of Virtual Product download link email not sent along with Payment Accepted email no sent in 1.3.6 I had to rename OrderHistory.php to OrderHistory.php.1.3.6 and upload an older version or OrderHistory from 1.3.2.3 You can get 1.3.2.3 here: http://code.google.com/p/prestashop/downloads/list Link to comment Share on other sites More sharing options...
shacker Posted February 4, 2011 Share Posted February 4, 2011 Thaks for the info!Some bugs not fixed in 1.3.6 Link to comment Share on other sites More sharing options...
benorbeen Posted June 4, 2011 Share Posted June 4, 2011 Its a bug if you use 1.3.6 version. To fix it just delete the last empty lines of those files/classes/Cart.php /classes/Currency.php /classes/Customer.php /classes/Meta.php /classes/OrderDetail.php /classes/Product.php This didn't seem to work for me, but since I can't currently access the Bug Tracker (search isn't working on the new Bug Tracker), I'm not 100% confident I know what is needed.Do I do the following?Change classes/Cart.php: /* DEPRECATED */ public function getCustomeremail() { $customer = new Customer(intval($this->id_customer)); return $customer->email; } } [bLANK LINE HERE] to: /* DEPRECATED */ public function getCustomeremail() { $customer = new Customer(intval($this->id_customer)); return $customer->email; } } That is, I take out the blank line (I couldn't represent it accurately using this bulletin board code).The other .php files actually end with ?> with a blank line just about that. Do I delete that blank line, or actually the ;> ? Link to comment Share on other sites More sharing options...
benorbeen Posted June 4, 2011 Share Posted June 4, 2011 Actually, nevermind! It seems that I wasn't thorough in my deleting the blank lines and that did the trick! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now