[php-src] Issue #12730: ZipArchive extract lost permission on linux
| From: | kocoten1992 | Date: | Mon, 20 Nov 2023 08:30:47 +0000 |
| Subject: | [php-src] Issue #12730: ZipArchive extract lost permission on linux | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245846@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/12730
Author: kocoten1992
### Description
Hello, I notice when using ZipArchive on linux, it lost permission of the file, for example, this
file:
https://chromedriver.storage.googleapis.com/114.0.5735.90/chromedriver_linux64.zip
When I use
unzip command line tool:
```
computer /tmp stat chromedriver
File: chromedriver
Size: 15039112 Blocks: 29376 IO Block: 4096 regular file
Device: 8,18 Inode: 6160498 Links: 1
Access: (0755/-rwxr-xr-x) Uid: ( 1000/kocoten1992) Gid: ( 1000/kocoten1992)
Access: 2023-05-27 07:10:14.000000000 +0700
Modify: 2023-05-27 07:10:14.000000000 +0700
Change: 2023-11-20 15:08:49.114203850 +0700
Birth: 2023-11-20 15:08:49.026201520 +0700
computer /tmp stat LICENSE.chromedriver
File: LICENSE.chromedriver
Size: 326542 Blocks: 640 IO Block: 4096 regular file
Device: 8,18 Inode: 6160513 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/kocoten1992) Gid: ( 1000/kocoten1992)
Access: 2023-05-27 07:10:14.000000000 +0700
Modify: 2023-05-27 07:10:14.000000000 +0700
Change: 2023-11-20 15:08:49.114203850 +0700
Birth: 2023-11-20 15:08:49.114203850 +0700
```
File chromedriver have permission 0755, however when use this code:
```php
<?php
$zip = new ZipArchive;
$zip->open('chromedriver_linux64.zip');
$zip->extractTo('/tmp/');
```
Now chromedriver have permission 0644, meaning - it lost information
previously there and I can't find how to preserve that info (permission) uzing ZipArchive api.