#30690 [Bgs->Opn]: Resource handle from ibase_execute becomes invalid after return
ID: 30690
Updated by: danielc@php.net
Reported By: kobaz at kobaz dot net
-Status: Bogus
+Status: Open
Bug Type: InterBase related
Operating System: Linux 2.6.5
PHP Version: 4.3.9
New Comment:
While this behavior may be intentional on your part, I strongly request
it be changed.
1) No other DBMS extension in PHP does this.
2) This makes writing programs using ibase very difficult.
3) This makes it impossible to write abstraction packages, such as PEAR
DB (which I'm the lead of).
Previous Comments:
------------------------------------------------------------------------
[2004-11-07 14:21:36] abies@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
When $prepare goes out of scope, it is cleaned up along with all the
resources that depend on it. That includes any results that it
created.
------------------------------------------------------------------------
[2004-11-05 02:16:40] kobaz at kobaz dot net
Description:
------------
Resource handle from ibase_execute becomes invalid after return
Reproduce code:
---------------
$conn = ibase_connect('localhost:db', 'SYSDBA', 'pass');
function DB_PQuery ($sql, $data) {
global $conn;
$prepare = ibase_prepare($conn, $sql);
$result = ibase_execute($prepare, $data);
// $A = ibase_fetch_assoc($result); // uncommenting this will
show resource is valid here
// print_r($A);
// after this function returns, the return value is no longer a valid
resource
return $result;
}
$result = DB_PQuery("SELECT * FROM testing WHERE a = ?", '1');
$A = ibase_fetch_assoc($result); // fails with: invalid statement
handle
print_r($A);
Expected result:
----------------
The ibase_fetch_assoc should be successful after DB_PQuery returns.
Actual result:
--------------
Before DB_PQuery returns, $result is a valid resource handle that can
be used with ibase_fetch_assoc successfully.
After DB_PQuery returns, the return value is not a valid resource
handle despite that nothing in the script has modified it.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30690&edit=1
Thread (6 messages)