Я согласен с ответом от zacherates.
Но вы можете сделать вызов intern () в ваших нелиберальных строках.
Из примера zacherates:
// ... but they are not the same object
new String("test") == "test" ==> false
Если вы ставите нелитеральное равенство строки, это правда
new String("test").intern() == "test" ==> true
ПОСЛЕ МНОГИХ ЧАСОВ ПОИСКА Я НАШЕЛ РЕШЕНИЕ ДЛЯ ЭТОГО!
Для любого из вас, кому это нужно ... Я решил свою проблему следующим образом:
$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
// Create a temporary file of and write our data to it
$excel_file_tmp = tempnam("/tmp", 'tmp');
$writer->save($excel_file_tmp);
// Now zip the file and move the temporary file to it
$zip_file_tmp = tempnam("/tmp", 'tmp');
$zip = new ZipArchive();
$zip->open($zip_file_tmp, ZipArchive::OVERWRITE);
$zip->addFile($excel_file_tmp, $job_id.'-space_capture_data.xlsx');
$zip->close();
Благодаря Arkadiusz G кто предоставил ответ: PHPExcel скачать в виде zip файла