php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72812 dbase_create does not close the FD on failure
Submitted: 2016-08-11 12:36 UTC Modified: 2016-08-11 13:21 UTC
From: cmb@php.net Assigned: cmb (profile)
Status: Closed Package: dbase (PECL)
PHP Version: Irrelevant OS: *
Private report: No CVE-ID: None
 [2016-08-11 12:36 UTC] cmb@php.net
Description:
------------
When dbase_create() fails (i.e. returns false) after it has opened
the file, the file descriptor is never closed. This can be seen
nicely on NTFS, where opened files are locked for some operations,
such as deletion.


Test script:
---------------
<?php
$db = dbase_create('foo.dbf', array(array('error', '-')));
var_dump($db);
var_dump(unlink('foo.dbf'));


Expected result:
----------------
Warning: dbase_create(): unknown field type '-' in …
bool(false)
bool(true)


Actual result:
--------------
Warning: dbase_create(): unknown field type '-' in …
bool(false)

Warning: unlink(foo.dbf): Text file busy in …
bool(false)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-08-11 12:36 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2016-08-11 13:14 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=339846
Log: Fix #72812: dbase_create does not close the FD on failure
 [2016-08-11 13:20 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=339847
Log: Merged revision(s) 339845-339846 from pecl/dbase/branches/dbase-5.1:

Fix #72812: dbase_create does not close the FD on failure
 [2016-08-11 13:21 UTC] cmb@php.net
-Status: Assigned +Status: Closed
 [2021-04-06 10:18 UTC] git@php.net
Automatic comment on behalf of 
Revision: https://github.com/php/pecl-database-dbase/commit/7130c4e58923e7040523cb8e73e5dfaaf51958b5
Log: Merged revision(s) 339845-339846 from pecl/dbase/branches/dbase-5.1:
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Nov 01 20:01:29 2024 UTC