Doc #78998 [Ver]: Fatal error: Undefined class constant 'EM_AES_256'
| From: | cmb@php.net | Date: | Thu, 19 Dec 2019 17:07:14 +0000 |
| Subject: | Doc #78998 [Ver]: Fatal error: Undefined class constant 'EM_AES_256' | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-17151@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78998&edit=1
ID: 78998
Updated by: cmb@php.net
Reported by: shariefjamiel at gmail dot com
Summary: Fatal error: Undefined class constant 'EM_AES_256'
Status: Verified
Type: Documentation Problem
Package: Zip Related
Operating System: ubuntu 18.04 - php 7.2.15
PHP Version: Irrelevant
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
> [â¦] but you need >= 1.2.0[1].
Oops! That should have been "but you need libzip >= 1.2.0".
Ubuntu 18.04 has only libzip 1.1.2-1.1 by default.
Previous Comments:
------------------------------------------------------------------------
[2019-12-19 11:48:49] shariefjamiel at gmail dot com
This is from TravisCI as well
$ php --version
PHP 7.2.15 (cli) (built: Feb 11 2019 23:22:17) ( ZTS )
Error: Undefined class constant 'ZipArchive::EM_NONE'
------------------------------------------------------------------------
[2019-12-19 11:45:17] shariefjamiel at gmail dot com
Sorry I am not following you, neither on Docker ubuntu 18.04 nor Travis CI ubuntu 14 maybe, when I
use PHP 7.2 this does not work. Only when I switch to PHP 7.3 does it work.
------------------------------------------------------------------------
[2019-12-19 11:23:47] cmb@php.net
It can work on PHP 7.2, but you need >= 1.2.0[1].
[1] <https://libzip.org/documentation/zip_file_set_encryption.html>
------------------------------------------------------------------------
[2019-12-19 10:55:40] shariefjamiel at gmail dot com
Description:
------------
Here and other places says this works on PHP 7.2 and above, when infact it only works on 7.3 and
above.
- https://www.php.net/manual/en/zip.constants.php
- https://www.php.net/manual/en/ziparchive.setencryptionname.php
Test script:
---------------
$archive = new ZipArchive();
if ($archive->open('foo.zip', ZipArchive::CREATE)!==true) {
exit("cannot open $filename");
}
$value = ZipArchive::EM_AES_256; // error
$archive->setEncryptionName('foo', ZipArchive::EM_AES_256, 'foo'); // also
doesnt work
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78998&edit=1