Home » File Formats » File_Archive » Bug #4327
PHP Hang on Permissions
Details
| Submitted | 2005-05-11 17:22 UTC |
|---|---|
| From | dmytton at php dot net |
| Status | No Feedback |
| Package | File_Archive |
| PHP Version | 4.3.11 |
| OS | Linux (Red Hat 7.2) |
| Roadmaps | (Not assigned) |
Comments
[2005-05-11 17:22 UTC] dmytton at php dot net
Description:
------------
Although I am not able to replicate this on my PHP 5/Windows or PHP 4.3.11/Linux system, one of my users is reporting a problem whereby if files within a directory are chmod 0777 (for example), PHP will hang when archiving the directory. It will only work correctly if they are of permission 0644. If the file permissions are anything higher than 0644 (e.g. 0700, 0755 or 0777), then the archiving of a full directory fails. This has been tested for both zip and tar archives with the same result.
PHP 4.3.11 (cli) (built: Apr 29 2005 01:38:06)
Copyright © 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright © 1998-2004 Zend Technologies
with Zend Extension Manager v1.0.6, Copyright © 2003-2004, by Zend Technologies
with Zend Optimizer v2.5.7, Copyright © 1998-2004, by Zend Technologies
Unix running Apache 1.3.3 - Cpanel
rpm -q tar
tar-1.13.25-4.7.1
The directory is PNETdloader/ and is as follows:
-rw-r--r-- 1 me me 3199 May 10 17:46 config_local.php
-rw-r--r-- 1 me me 28096 May 10 17:44 install
-rw-r--r-- 1 me me 5505 May 10 19:35 install_license.php
-rw-r--r-- 1 me me 3726 May 10 20:39 install.txt
-rw-r--r-- 1 me me 4952 May 10 19:35 license_check.php
-rw-r--r-- 1 me me 7871 May 10 16:25 license.txt
-rw-r--r-- 1 me me 5006 May 10 19:35 PNETdloader.php
This works fine. However, some files need to be writable by default when the archive is extracted, but changing them to 0755 (for example) causes PHP to hang.
Reproduce code:
---------------
$ext = '.tar';
$location = 'PNETdloader/'
$source = File_Archive::read($location, $location);
$source->extract(File_Archive::toArchive($location.$ext, File_Archive::toFiles()));
Expected result:
----------------
The zip archive/tar archive should be created.
Actual result:
--------------
Fatal error: Maximum execution time of 30 seconds exceeded in /usr/lib/php/PEAR.php on line 820
[2005-05-11 18:33 UTC] dmytton at php dot net
That was mistake I made when writing the example code. The actual code is embedded into a class that I've written to handle downloads so I extracted the code and provided it in a useful format so you can try and replicate it. The actual value of $location will not actually have a / in it. The archive created is called $location.tar and in this case, should be PNETdloader.tar. Also, the finished archive is not created within the source directory, it is created within the directory that the script is running from.
The actual code I am using copied directly from my class is:
$ext = '.tar';
// We need to change to the the release_source directory
if (chdir($iono->settings['release_source_path']))
{
$source = File_Archive::read($location, $location);
$source->extract(File_Archive::toArchive($location.$ext, File_Archive::toFiles()));
chdir('../');
}
$iono->settings['release_source_path'] is a full path to the directory such as /home/username/public_html/files with $location being the location of the file or directory to archive relative to the $iono->settings['release_source_path'] directory
[2005-05-13 21:36 UTC] dmytton at php dot net
Waiting for my customer to reply to my request...If they don't respond by next week, I'll close this issue since I can't replicate it myself.
[2005-05-19 14:50 UTC] dmytton at php dot net
Can't reproduce. No response from customer.