Topic: Permission rights using ZipArchive

Hi Remi and community,

I hope that somebody can help me with this small problem.

Since PHP 5.6 (and maybe PECL zip >= 1.12.4) the permission rights of files and folders are not set properly using the PHP function ZipArchive (http://php.net/manual/de/class.ziparchive.php).

The original files have 0644 and folder 0755 but the rights in the zip package for files are 0666 and folders 0777. I've tested it again with an older version of PHP (5.5.x) and all rights were set properly.

I already tried to set the rights with setExternalAttributesName using the example code but then the files have no rights at all 0000 instead of the original rights...

I don't know how to solve it. Is it a bug or just wrong usage of the function?

Thank you in advance!

Viktor

Re: Permission rights using ZipArchive

I rather think this is related to a change in libzip (I don't see any change which can explain this in the ext.)

I Will try to dig this issue.

Desktop: Fedora 25 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 24 x86_64 + remi (SCL only)
Hosting Server: CentOS 6.8 x86_64 + EPEL + remi + remi-php70

Re: Permission rights using ZipArchive

Thank you, Remi!

Would be great if you could find the source of the problem.

Cheers

Re: Permission rights using ZipArchive

I think everything works as expected wink

Excepted the documentation, in which code sample is not correct: http://svn.php.net/viewvc?view=revision … ion=339282

Desktop: Fedora 25 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 24 x86_64 + remi (SCL only)
Hosting Server: CentOS 6.8 x86_64 + EPEL + remi + remi-php70

Re: Permission rights using ZipArchive

Remi, you are awesome!

Just tested it with your updated code and it works properly.

Merci beaucoup!

Re: Permission rights using ZipArchive

smile

Desktop: Fedora 25 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 24 x86_64 + remi (SCL only)
Hosting Server: CentOS 6.8 x86_64 + EPEL + remi + remi-php70

Re: Permission rights using ZipArchive

> Remi, you are awesome!

Thanks,  if you want => http://blog.remirepo.net/pages/User-testimonials

Desktop: Fedora 25 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 24 x86_64 + remi (SCL only)
Hosting Server: CentOS 6.8 x86_64 + EPEL + remi + remi-php70

Re: Permission rights using ZipArchive

For history, here is the quick written scripts I have used to check everything works as expected

http://blog.remirepo.net/public/php/zip.txt
http://blog.remirepo.net/public/php/unzip.txt

- zip with php, unzip with php
- zip with php, unzip with unzip command
- zip with zip command, unzip with php

Remi.

Desktop: Fedora 25 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 24 x86_64 + remi (SCL only)
Hosting Server: CentOS 6.8 x86_64 + EPEL + remi + remi-php70