Edit report at https://bugs.php.net/bug.php?id=72175&edit=1
ID: 72175
Comment by: vitorhugohoch at gmail dot com
Reported by: netvicious at gmail dot com
Summary: Impossibility of creating multiple connections to
Interbase with php 7.x
Status: Closed
Type: Bug
Package: InterBase related
Operating System: Ubuntu 16.04 LTS
PHP Version: 7.x
Assigned To: nikic
Block user comment: N
Private report: N
New Comment:
If you close two connections (rows) with one variable handling the conection like
$conn = "IBASE/FIREBIRD Query path";
(code... $row...)
fbird_free_result($resABC);
fbird_close($conn);
fbird_free_result($resXYZ);
fbird_close($conn);
Get that error but do the query (row):
ibase_fetch_assoc(): invalid statement handle
I dont' know if this is an error.
If it is an error, would it be impossible to close multiple results with a connection on the same
page?
Previous Comments:
------------------------------------------------------------------------
[2019-03-25 15:48:28] nikic@php.net
I've now applied a much more limited version of the previous patch to 7.2 and upwards. It
should fix this issue and just this issue. The other changes should still happen, because they fix
potential use-after-free and memory leaks, but we should probably wait with those more intrusive
changes until the extension has a maintainer.
------------------------------------------------------------------------
[2019-03-25 15:44:22] nikic@php.net
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=85095dfd0956bc09f5157211948c40cfa2859d27
Log: Fixed bug #72175
------------------------------------------------------------------------
[2019-03-25 07:27:25] martin dot koeditz at it-syn dot de
Hello Nikita, hello Lester
I am also working on a patch. So I thought, I inform you about this.
I will check Nikita's patch too. But looks very promising. If this works, we should check it
in.
Regards,
Martin
------------------------------------------------------------------------
[2019-03-23 15:33:23] lester at lsces dot co dot uk
I have a test running on 7.2.16 ...
http://smallbrook.co.uk:800/ibtest2.php
http://smallbrook.co.uk:800/ibtest3.php
creates a connection to a second database and then 2 to the example database ... so Resource id #3
is duplicated nicely ...
It is worth pointing out that the problem was never with creating multiple connections, but rather
with trying to start a second connection to the same database. In reality all that is required is to
simply use the existing connection, and nikita's patch neatly restores that operation under the
hood. It simply returns the existing resource handle when a duplicate database is used.
------------------------------------------------------------------------
[2019-03-22 16:19:11] nikic@php.net
Here is a possible patch against the PHP 7.3 branch: https://gist.github.com/nikic/ef81684007753232893eae7acc034196
This should resolve this issue and some of the other more blatant refcounting bugs. Because it does
so, it may also change the behavior of ibase_close to close all shared connections. I've added
a hack to avoid closing the default link, but it may be better to just make ibase_close a no-op
instead.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=72175
--
Edit this bug report at https://bugs.php.net/bug.php?id=72175&edit=1