I am trying to set a multi-line comment with ZipArchive.Below is a simplified demo.
<?php
$comment = "File \t Stats
";
$comment .= "Second line ...some another text
";
$zip->setArchiveComment($comment);
I then open the zip file with Winrar on my windows machine and in the comment you can see ,
\t
appearing as is ... indicating that either winrar don't allow this or i wrong set the zipArchive comment.
I cannot reproduce your problem based on your simplified demo. WinRAR displays it as expected. But I can mimic the result you get by using single quotes for the comment string.
<?php
$zip = new ZipArchive;
$res = $zip->open('test.zip', ZipArchive::CREATE);
if ($res === TRUE) {
$zip->addFromString('test.txt', 'file content goes here');
$zip->setArchiveComment("File \t Stats
Second line ... some other text
"); // OK
$comment = "File \t Stats
";
$comment .= 'Second line ... some other text
';
$zip->setArchiveComment($comment); // NOT OK for the second line
$zip->close();
echo 'ok';
} else {
echo 'failed';
}