php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74307 if the function threw an exception, it does not close the file descriptor
Submitted: 2017-03-24 09:01 UTC Modified: 2019-04-14 04:22 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: atlantidu at gmail dot com Assigned: cmb (profile)
Status: No Feedback Package: dbase (PECL)
PHP Version: 7.0.17 OS: Linux 4.4.0-53-generic #74-Ubunt
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: atlantidu at gmail dot com
New email:
PHP Version: OS:

 

 [2017-03-24 09:01 UTC] atlantidu at gmail dot com
Description:
------------
Real PHP version (from phpinfo): PHP Version 7.0.15-0ubuntu0.16.04.4
dbase version: 7.0.0beta1

I don't know why some dbf files do not open, but when it happens the function don't closes a file descriptor, and that's bad. Don't know if I have the opportunity to close file descriptors?

I execute: php -r 'var_dump(dbase_open("/tmp/fias/NORDOC01.DBF", 0));'
output:
PHP Warning:  dbase_open(): unable to open database /tmp/fias/NORDOC01.DBF in Command line code on line 1
PHP Stack trace:
PHP   1. {main}() Command line code:0
PHP   2. dbase_open() Command line code:1
Command line code:1:
bool(false)

I know that the problem is in the dbf file. But how to close the file descriptor? The problem is that open file descriptors exceeds the limit of this process and I get the error "Too many open files"

PHP

$ sudo apt-cache show php7.0

Package: php7.0
Priority: optional
Section: php
Installed-Size: 9
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>
Architecture: all
Version: 7.0.15-0ubuntu0.16.04.4
Provides: php
Depends: php7.0-fpm | libapache2-mod-php7.0 | php7.0-cgi, php7.0-common (= 7.0.15-0ubuntu0.16.04.4)
Conflicts: php5 (<< 5.6.16+dfsg-4~)
Filename: pool/main/p/php7.0/php7.0_7.0.15-0ubuntu0.16.04.4_all.deb
Size: 1284
MD5sum: 00e8eebf13c1757ddb11b5d7c57b3e5a
SHA1: f9a65634c362e1d47e4dba795099c454cdf31706
SHA256: be5e6be0f75298b46eb7646ba15a34005f3b4daaa0af4ced04ad09c22cc2016e
Description-en: ...
Description-md5: 86488d7a405bdcbac9ece7c307f30abb
Homepage: http://www.php.net/
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu
Supported: 5y


DBASE

$ pecl info dbase
About pecl.php.net/dbase-7.0.0beta1
===================================
Release Type          PECL-style PHP extension (source code)
Name                  dbase
Channel               pecl.php.net
Summary               dBase database file access functions
Description           ...
Maintainers           ...
Release Date          2016-10-26 09:53:14
Release Version       7.0.0beta1 (beta)
API Version           7.0 (beta)
License               PHP (http://www.php.net/license)
Release Notes         - PHP 7 compatibility (use dbase-5 with PHP 5)
                      - Fixed #39305: Use of decimal point in
                      different countries
                      - Fixed #52112: dbase_get_record() returns
                      integer instead of decimal values
                      - Fixed #68289: wrong strlcpy call
                      - Fixed #72812: dbase_create does not close the
                      FD on failure
                      - Fixed #72815: zend_get_parameters_ex() is
                      deprecated
Required Dependencies PHP version 7.0.0
                      PEAR installer version 1.4.0b1 or newer
package.xml version   2.0
Last Modified         2017-03-21 12:18
Previous Installed    - None -
Version

$ php -m
[PHP Modules]
bz2
calendar
Core
ctype
curl
date
dbase
dom
exif
fileinfo
filter
ftp
gettext
hash
iconv
intl
json
libxml
mbstring
mcrypt
openssl
pcntl
pcre
PDO
pdo_pgsql
pgsql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xdebug
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Xdebug
Zend OPcache


$ lsb_release -a
No LSB modules are available.
Distributor ID:	LinuxMint
Description:	Linux Mint 18.1 Serena
Release:	18.1
Codename:	serena

$ uname -a
Linux 4.4.0-53-generic #74-Ubuntu SMP Fri Dec 2 15:59:10 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux


Test script:
---------------
A test script is missing, because the problem in DBF file. File here: https://yadi.sk/d/KfqylbSg3GJSSw

Expected result:
----------------
I expect that the function will return false, as described here (http://php.net/manual/en/function.dbase-open.php) and will close the open file

Actual result:
--------------
PHP Warning:  dbase_open(): unable to open database /tmp/fias/NORDOC01.DBF in Command line code on line 1
PHP Stack trace:
PHP   1. {main}() Command line code:0
PHP   2. dbase_open() Command line code:1
Command line code:1:

And file descriptor do not close!

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-03-25 11:13 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2017-03-25 11:13 UTC] cmb@php.net
This might already have been fixed by r340807[1]. I'll have a
closer look and release the new version ASAP.

[1] <http://svn.php.net/viewvc?view=revision&revision=340807>
 [2019-04-04 08:58 UTC] cmb@php.net
-Status: Assigned +Status: Feedback
 [2019-04-04 08:58 UTC] cmb@php.net
Sorry that it took so long for dbase 7.0.0RC1.  Anyhow, please
confirm whether this issue is fixed in the new release, and
re-open the ticket otherwise.
 [2019-04-14 04:22 UTC] pecl-dev at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC