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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
45 + 38 = ?
Subscribe to this entry?

 
 [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
 [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: Thu Apr 18 23:01:27 2024 UTC