php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57440 rar_close does not close handles opened by rar_list (WAS: Archive not closing)
Submitted: 2006-12-18 09:54 UTC Modified: 2009-11-21 13:57 UTC
From: andy at andy-burton dot co dot uk Assigned:
Status: Closed Package: rar (PECL)
PHP Version: 5.2.0 RC4 OS: Windows XP Pro
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: andy at andy-burton dot co dot uk
New email:
PHP Version: OS:

 

 [2006-12-18 09:54 UTC] andy at andy-burton dot co dot uk
Description:
------------
I am running PHP 5.2.0 under Apache 2.0.55 on Windows XP Pro SP2, and using the php_rar.dll found on http://pecl4win.php.net/list.php.

I have created a simple test script to play with this extension.

Reproduce code:
---------------
<?php

$resRar		= rar_open ('/home/public_html/tests/test.rar');
$arrFiles	= rar_list ($resRar);

foreach ($arrFiles as $objFile)
{
	echo 'Filename: ' . $objFile->getName () . '<br />';
	$objFile->extract ('/home/public_html/tests/rar/');
}

if (!rar_close ($resRar))
{
	echo 'Not Closed';
}

unlink ('/home/public_html/tests/test.rar');

?>

Expected result:
----------------
The script is expected to open the rar archive, extract the contents, close the archive and delete it.

Actual result:
--------------
The archive is opened and extracted successfully, but does not seem to be closed correctly despite the use of rar_close.

A "Permission denied" error is returned for the unlink function, and i cannot delete the file through windows until i restart apache.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-02-13 18:32 UTC] tony2001 at phpclub dot net
The case when rar_open() returns FALSE is when you provide an specify Rar resource.
So this is something I cannot reproduce for sure.
 [2009-11-20 20:40 UTC] glopes at nebm dot ist dot utl dot pt
I can confirm this bug as of revision #291092
A few points:
- rar_list seems to be the culprit (if RarEntry::extract does not close handles, it is in addition of rar_list)
- restarting apache is not necessary, which probably means the handle is destroyed when the script finishes
- tested with pecl rar revision #291092, apache 2.2.14, PHP 5.3.2-dev (Nov 3 2009 16:47:26), windows 7 64-bit
 [2009-11-21 13:57 UTC] glopes at nebm dot ist dot utl dot pt
Fixed in revision #29119.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC