Bug #14039 [Com]: Invalid statement handle

From: Date: Mon, 16 Oct 2017 19:30:26 +0000
Subject: Bug #14039 [Com]: Invalid statement handle
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-211734@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: ffortuny 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: 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. Previous Comments: ------------------------------------------------------------------------ [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 ------------------------------------------------------------------------ [2001-11-13 04:41:52] 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 : <?php function foo() { $link = ibase_connect("//ibase/mybase", "login", "password"); .... // some code here ibase_close ($link); return -1; // generates the warning } $x = foo(); // warning displayed > ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=14039&edit=1

« previous php.bugs (#211734) next »