php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #46013 problem with zip php functions and symbolic links
Submitted: 2008-09-06 20:43 UTC Modified: 2009-09-23 01:00 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (50.0%)
From: black-cod3 at live dot com Assigned: pajoye (profile)
Status: No Feedback Package: Feature/Change Request
PHP Version: 5.2.6 OS: linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: black-cod3 at live dot com
New email:
PHP Version: OS:

 

 [2008-09-06 20:43 UTC] black-cod3 at live dot com
Description:
------------
When using the zip php functions to extract or read a zip file containing a symbolic link (ex: indx -> /home/myuser/public_html/index.html) it fails to extract the original symbolic link it only returned the link name and it's contents is the symbolic link path.


ln -s /home/myuser/public_html/index.html indx;ls -la 
28672300 lrwxrwxrwx  1 myuser mygroup   35 Sep  6 13:41 indx -> /home/myuser/public_html/index.html

zip -y indx.zip indx;ls -la 
28672300 lrwxrwxrwx  1 myuser mygroup   35 Sep  6 13:41 indx -> /home/myuser/public_html/index.html
28672304 -rw-r--r--  1 myuser mygroup  175 Sep  6 14:50 indx.zip

extracting php code to the indx.zip as following: 


Reproduce code:
---------------
<?php
$zip = new ZipArchive;
if ($zip->open('indx.zip') === TRUE) {
    $zip->extractTo('/home/myuser/public_html/');
    $zip->close();
    echo 'done';
} else {
    echo 'failed';
}
?>

Expected result:
----------------
expected to be extracted as :

indx -> /home/myuser/public_html/index.html

Actual result:
--------------
but actual reslult is :

indx

and the contents of indx is :

/home/myuser/public_html/index.html


Thx for your attention and hope to know if there is a different coding method to zip a symbolic link by php zip functions or the above code was expected to works well?

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-09-06 20:56 UTC] black-cod3 at live dot com
Also note that when zipping the symbolic link using php code as:

<?php
$zip = new ZipArchive;
$res = $zip->open('indx.zip', ZipArchive::CREATE);
if ($res === TRUE) {
    $zip->addFile('indx');
    $zip->close();
    echo 'ok';
} else {
    echo 'failed';
}
?>

also the result after extracting indx.zip with the above php extracting code:

indx
 [2008-09-07 11:01 UTC] pajoye@php.net
Symbolic links are not yet supported (extra flags/fields).
 [2008-09-07 13:27 UTC] black-cod3 at live dot com
yes i see, thanks pajoye..
 [2009-09-06 22:02 UTC] pajoye@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2009-09-14 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2009-09-15 21:08 UTC] pajoye@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2009-09-23 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2017-10-11 09:51 UTC] lupinek7 at gmail dot com
I'm experiencing the same problem in PHP 7.1.10
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Sep 15 15:00:01 2025 UTC