Bug #14039 [Com]: Invalid statement handle

From: Date: Mon, 07 May 2018 19:40:32 +0000
Subject: Bug #14039 [Com]: Invalid statement handle
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-215149@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=14039&edit=1

 ID:                 14039
 Comment by:         ucijas at gmail dot com
 Reported by:        opolette at yahoo dot com
 Summary:            Invalid statement handle
 Status:             Closed
 Type:               Bug
 Package:            InterBase related
 Operating System:   Windows NT 4 SP 4
 PHP Version:        4.0.6
 Block user comment: N
 Private report:     N

 New Comment:

See also Bug #72175


Previous Comments:
------------------------------------------------------------------------
[2018-05-07 19:39:38] ucijas at gmail dot com

Related To: Bug #72175

------------------------------------------------------------------------
[2017-10-16 19:30:21] 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) {
  glGetThat();
}

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.

------------------------------------------------------------------------
[2017-10-16 16:33:55] 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 http://php.net/manual/de/function.ibase-fetch-object.php
but when you look at http://php.net/manual/de/mysqli-result.fetch-object.php
it should look like

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

------------------------------------------------------------------------
[2017-10-16 16:26:43] 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).

------------------------------------------------------------------------
[2002-04-13 14:37:59] daniela@php.net

The version of PHP that this bug was reported in is too old. 
Please try the php-4.2.0RC3 from http://www.php.net/~derick/ 

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:
http://www.php.net/manual/en/function.ibase-close.php

Daniela





------------------------------------------------------------------------


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=14039


--
Edit this bug report at https://bugs.php.net/bug.php?id=14039&edit=1


Thread (1 message)

  • ucijas at gmail dot com
  • Unknown Message
    • ucijas at gmail dot com
« previous php.bugs (#215149) next »