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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Tue Apr 23 21:01:31 2024 UTC