|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14039 Invalid statement handle
Submitted: 2001-11-13 04:41 UTC Modified: 2002-04-13 14:37 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: opolette at yahoo dot com Assigned:
Status: Closed Package: InterBase related
PHP Version: 4.0.6 OS: Windows NT 4 SP 4
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: opolette at yahoo dot com
New email:
PHP Version: OS:


 [2001-11-13 04:41 UTC] opolette at yahoo dot com
When exiting a function after having closed a link to Interbase, the warning "Invalid statement handle" is displayed. apparently, PHP tries to close the connection by itself even if it has already been closed, which raises this warning from interbase.

Example :

  function foo() {
          $link = ibase_connect("//ibase/mybase", "login", "password");
          .... // some code here
          ibase_close ($link);
          return -1; // generates the warning 

    $x = foo();  // warning displayed



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-13 14:37 UTC]
The version of PHP that this bug was reported in is too old. 
Please try the php-4.2.0RC3 from 

If you are still able to reproduce the bug, please change the PHP
version on this bug report to the version you tested and change 
the status back to "Open".

This bug should be fixed now.
You were right, the problem was in ibase_close().
However have a look at:


 [2017-10-16 16:26 UTC] ffortuny at gmail dot com
Apparently, it has not been reported that this problem is now again in version 7.0 (at least, I have not checked 7.1).

For 3 years this statement:

while($fl = ibase_fetch_object($res)) {
 // $res = sql with 17 columns and a maximum of 30 rows

had been working seamlessly in up to version 5.6. As the app is now in a server with php 7.0, this is the only statement failing (so far).
 [2017-10-16 16:33 UTC] spam2 at rhsoft dot net
this is broken code anyways, a sane IDE would tell you (assignment in condition)
while($fl = ibase_fetch_object($res))

the docs don't tell anything at but when you look at it should look like

while(($fl = ibase_fetch_object($res)) !== NULL)
 [2017-10-16 19:30 UTC] ffortuny at gmail dot com
I discovered where the problem was.

I versions prior to 7.0, it was possible to execute

ibase_connect( ... ) a second (or third time or more) without anything like this happening.

In version 7.0, if a function tries to execute ibase_connect() then the environment from where such function was called loses values of variables and can not continue.

As the function called, which executed a second ibase_connect in one POST, returns, then the previous environment breaks.

I had this:

while(($fl = ibase_fetch_object($res)) !== NULL) {

function glGetThat() had a connection, which would be redundant, but after it returned from glGetThat() then $res had lost the value it had to continue retrieving the query results.

I hope this is useful, because a non-documented change has happened in version 7.0 which affects the way ibase_connect() behaves.
 [2018-05-07 19:40 UTC] ucijas at gmail dot com
See also Bug #72175
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 18:01:36 2024 UTC