note 129837 added to ziparchive.setencryptionname

From: Date: Wed, 06 Nov 2024 06:53:01 +0000
Subject: note 129837 added to ziparchive.setencryptionname
Groups: php.notes 
Request: Send a blank email to php-notes+get-221632@lists.php.net to get a copy of this message
When using setEncryptionName, the first parameter is equal to the entry name of the file you added. In case you set an explicit entry name with the second parameters of the addFile method, then you need to use that entry name. Using the first parameter of addFile will only work in case the second parameter is not used. This works : $zip->addFile('test.txt', 'my_awesome_textfile.txt'); $zip->setEncryptionName('my_awesome_textfile.txt', ZipArchive::EM_AES_256); This does not work and will generate an archive without any encryption : $zip->addFile('test.txt', 'my_awesome_textfile.txt'); $zip->setEncryptionName('text.txt', ZipArchive::EM_AES_256); ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.5.137 (proxied: 106.73.141.129) ---- Manual Page -- https://php.net/manual/en/ziparchive.setencryptionname.php Edit -- https://main.php.net/note/edit/129837 Del: integrated -- https://main.php.net/note/delete/129837/integrated Del: useless -- https://main.php.net/note/delete/129837/useless Del: bad code -- https://main.php.net/note/delete/129837/bad+code Del: spam -- https://main.php.net/note/delete/129837/spam Del: non-english -- https://main.php.net/note/delete/129837/non-english Del: in docs -- https://main.php.net/note/delete/129837/in+docs Del: other reasons-- https://main.php.net/note/delete/129837 Reject -- https://main.php.net/note/reject/129837 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221632) next »