From dece018a419f3133b5f1076848b74ef2c890b7d0 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Thu, 31 Jan 2008 00:26:44 +0000 Subject: [PATCH] Fixed bug #42841 (REF CURSOR and oci_new_cursor PHP crash) --- ext/oci8/oci8_statement.c | 8 ++ ext/oci8/tests/bug42841.phpt | 187 +++++++++++++++++++++++++++++++++++ 2 files changed, 195 insertions(+) create mode 100644 ext/oci8/tests/bug42841.phpt 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 -- 2.50.1