1--TEST-- 2setComment error behavior 3--SKIPIF-- 4<?php 5if(!extension_loaded('zip')) die('skip zip extension not available'); 6?> 7--FILE-- 8<?php 9$file = __DIR__ . '/__tmp_oo_set_comment_error.zip'; 10 11@unlink($file); 12 13$zip = new ZipArchive; 14if (!$zip->open($file, ZIPARCHIVE::CREATE)) { 15 exit('failed'); 16} 17 18$zip->addFromString('entry1.txt', 'entry #1'); 19$zip->addFromString('entry2.txt', 'entry #2'); 20 21$longComment = str_repeat('a', 0x10000); 22 23var_dump($zip->setArchiveComment($longComment)); 24var_dump($zip->setCommentName('entry1.txt', $longComment)); 25var_dump($zip->setCommentIndex(1, $longComment)); 26 27$zip->close(); 28?> 29===DONE=== 30--EXPECTF-- 31Warning: ZipArchive::setArchiveComment(): Comment must not exceed 65535 bytes in %s on line %d 32bool(false) 33 34Warning: ZipArchive::setCommentName(): Comment must not exceed 65535 bytes in %s on line %d 35bool(false) 36 37Warning: ZipArchive::setCommentIndex(): Comment must not exceed 65535 bytes in %s on line %d 38bool(false) 39===DONE=== 40--CLEAN-- 41<?php 42@unlink(__DIR__ . '/__tmp_oo_set_comment_error.zip'); 43?> 44