ID: 42841
Updated by: [EMAIL PROTECTED]
Reported By: pr0head at gmail dot com
Status: Open
Bug Type: OCI8 related
Operating System: Linux version 2.6.20-gentoo-r8
PHP Version: 5.2.4
New Comment:
This was a latent bug exposed when statement caching was fixed.
The temporary workaround is to set oci8.statement_cache_size=0
The real solution (thanks to Sree) is to add a missing case for
cursors to the out-bind callback:
diff -u oci8_statement.c.orig oci8_statement.c
--- oci8_statement.c.orig 2008-01-30 10:37:32.000000000 -0800
+++ oci8_statement.c 2008-01-30 10:21:31.000000000 -0800
@@ -1174,6 +1174,14 @@
}
if (Z_TYPE_P(val) == IS_RESOURCE) {
+ /* Processing for ref-cursor out binds */
+ if (phpbind->statement != NULL) {
+ *bufpp = phpbind->statement;
+ *alenpp = &phpbind->dummy_len;
+ *piecep = OCI_ONE_PIECE;
+ *rcodepp = &phpbind->retcode;
+ *indpp = &phpbind->indicator;
+ }
retval = OCI_CONTINUE;
} else if (Z_TYPE_P(val) == IS_OBJECT) {
if (!phpbind->descriptor) {
Previous Comments:
------------------------------------------------------------------------
[2008-01-09 19:40:42] [EMAIL PROTECTED]
The original testcase (with the parameter only as OUT) does not crash
with OCI8 1.3.0 Beta from PECL.
------------------------------------------------------------------------
[2007-12-14 18:53:08] michael dot virnstein at brodos dot de
This fix only works for out parameters, not for return values from
functions. I can't change thosea.
I also filed the bug (Bug #43449), haven't found the other two.
------------------------------------------------------------------------
[2007-12-11 20:39:37] [EMAIL PROTECTED]
I reproduced the crash. The problem appears to be the same as reported
in http://bugs.php.net/bug.php?id=43340. If you change the PL/SQL
package definition so out_1 is an "IN OUT" parameter, there is no crash.
------------------------------------------------------------------------
[2007-11-20 09:46:48] pr0head at gmail dot com
This script working normally if not reopen cursor.
Bad result:
$sql = "BEGIN sp_vadik_1( :cursor ); END;";
$stmt = oci_parse( $connection, $sql );
$cursor = oci_new_cursor( $connection );
oci_bind_by_name( $stmt, ":cursor", $cursor, -1, OCI_B_CURSOR );
oci_execute( $stmt, OCI_DEFAULT );
oci_execute( $cursor );
oci_free_statement( $stmt );
oci_free_statement( $cursor );
$sql = "BEGIN sp_vadik_1( :cursor ); END;";
$stmt = oci_parse( $connection, $sql );
$cursor = oci_new_cursor( $connection );
oci_bind_by_name( $stmt, ":cursor", $cursor, -1, OCI_B_CURSOR );
oci_execute( $stmt, OCI_DEFAULT );
oci_execute( $cursor );
oci_free_statement( $stmt );
oci_free_statement( $cursor );
Good result:
$sql = "BEGIN sp_vadik_1( :cursor ); END;";
$stmt = oci_parse( $connection, $sql );
$cursor = oci_new_cursor( $connection );
oci_bind_by_name( $stmt, ":cursor", $cursor, -1, OCI_B_CURSOR );
oci_execute( $stmt, OCI_DEFAULT );
oci_execute( $cursor );
oci_free_statement( $stmt );
$sql = "BEGIN sp_vadik_1( :cursor ); END;";
$stmt = oci_parse( $connection, $sql );
oci_bind_by_name( $stmt, ":cursor", $cursor, -1, OCI_B_CURSOR );
oci_execute( $stmt, OCI_DEFAULT );
oci_execute( $cursor );
oci_free_statement( $stmt );
oci_free_statement( $cursor );
------------------------------------------------------------------------
[2007-11-20 01:00:00] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
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
http://bugs.php.net/42841
--
Edit this bug report at http://bugs.php.net/?id=42841&edit=1