From: Christopher Jones Date: Thu, 31 Jan 2008 00:26:44 +0000 (+0000) Subject: Fixed bug #42841 (REF CURSOR and oci_new_cursor PHP crash) X-Git-Tag: php-5.2.6RC1~117 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dece018a419f3133b5f1076848b74ef2c890b7d0;p=php Fixed bug #42841 (REF CURSOR and oci_new_cursor PHP crash) --- diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c index 2a51442dac..17822d5b3b 100644 --- a/ext/oci8/oci8_statement.c +++ b/ext/oci8/oci8_statement.c @@ -1174,6 +1174,14 @@ sb4 php_oci_bind_out_callback( } 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) { diff --git a/ext/oci8/tests/bug42841.phpt b/ext/oci8/tests/bug42841.phpt new file mode 100644 index 0000000000..921c8149dd --- /dev/null +++ b/ext/oci8/tests/bug42841.phpt @@ -0,0 +1,187 @@ +--TEST-- +Bug #42841 (REF CURSOR and oci_new_cursor PHP crash) +--SKIPIF-- + +--INI-- +oci8.statement_cache_size=20 +--FILE-- + +--EXPECT-- +Test bug 42841: Procedure with OUT cursor parameter +First attempt +array(3) { + [0]=> + array(1) { + [11]=> + string(2) "11" + } + [1]=> + array(1) { + [11]=> + string(2) "12" + } + [2]=> + array(1) { + [11]=> + string(2) "13" + } +} +Second attempt +array(3) { + [0]=> + array(1) { + [11]=> + string(2) "11" + } + [1]=> + array(1) { + [11]=> + string(2) "12" + } + [2]=> + array(1) { + [11]=> + string(2) "13" + } +} +Test bug 43449: Cursor as function result +array(1) { + [0]=> + array(1) { + ["DUMMY"]=> + string(1) "X" + } +} +array(1) { + [0]=> + array(1) { + ["DUMMY"]=> + string(1) "X" + } +} +Done