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

Add a Patch

Pull Requests

Add a Pull Request

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
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Oct 29 02:01:24 2020 UTC