diff options
| author | Christopher Jones <sixd@php.net> | 2008-02-15 23:05:19 +0000 |
|---|---|---|
| committer | Christopher Jones <sixd@php.net> | 2008-02-15 23:05:19 +0000 |
| commit | 6c0abfe077468985b07e515f4329a3e4da2b62b5 (patch) | |
| tree | 557b82fe5df292e2f50f1b73955b87b3432ea7a7 | |
| parent | 9da1ec78c0ad8b8bcabbacdf24ff4fb4351e6513 (diff) | |
| download | php-git-6c0abfe077468985b07e515f4329a3e4da2b62b5.tar.gz | |
Bug #44113 (New collection creation can fail with OCI-22303)
| -rw-r--r-- | ext/oci8/oci8_collection.c | 10 | ||||
| -rw-r--r-- | ext/oci8/tests/bug44113.phpt | 53 |
2 files changed, 61 insertions, 2 deletions
diff --git a/ext/oci8/oci8_collection.c b/ext/oci8/oci8_collection.c index 9095c5d2c6..5f56e376b1 100644 --- a/ext/oci8/oci8_collection.c +++ b/ext/oci8/oci8_collection.c @@ -44,9 +44,9 @@ /* {{{ php_oci_collection_create() Create and return connection handle */ -php_oci_collection * php_oci_collection_create(php_oci_connection* connection, char *tdo, int tdo_len, char *schema, int schema_len TSRMLS_DC) +php_oci_collection * php_oci_collection_create(php_oci_connection *connection, char *tdo, int tdo_len, char *schema, int schema_len TSRMLS_DC) { - dvoid *dschp1; + dvoid *dschp1 = NULL; dvoid *parmp1; dvoid *parmp2; php_oci_collection *collection; @@ -219,11 +219,17 @@ php_oci_collection * php_oci_collection_create(php_oci_connection* connection, c goto CLEANUP; } + /* free the describe handle (Bug #44113) */ + PHP_OCI_CALL(OCIHandleFree, ((dvoid *) dschp1, OCI_HTYPE_DESCRIBE)); PHP_OCI_REGISTER_RESOURCE(collection, le_collection); return collection; CLEANUP: + if (dschp1) { + /* free the describe handle (Bug #44113) */ + PHP_OCI_CALL(OCIHandleFree, ((dvoid *) dschp1, OCI_HTYPE_DESCRIBE)); + } php_oci_error(connection->err, connection->errcode TSRMLS_CC); php_oci_collection_close(collection TSRMLS_CC); return NULL; diff --git a/ext/oci8/tests/bug44113.phpt b/ext/oci8/tests/bug44113.phpt new file mode 100644 index 0000000000..646f09b7c7 --- /dev/null +++ b/ext/oci8/tests/bug44113.phpt @@ -0,0 +1,53 @@ +--TEST-- +Bug #44113 (New collection creation can fail with OCI-22303) +--SKIPIF-- +<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?> +--FILE-- +<?php + +require dirname(__FILE__).'/connect.inc'; + +// Initialization + +$stmtarray = array( + "create or replace type bug44113_list_t as table of number" +); + +foreach ($stmtarray as $stmt) { + $s = oci_parse($c, $stmt); + @oci_execute($s); +} + +// Run Test +// The test can take some time to complete and can exceed PHP's test +// timout limit on slow networks. + +for ($x = 0; $x < 70000; $x++) +{ + if (!($var = oci_new_collection($c, 'BUG44113_LIST_T'))) { + print "Failed new collection creation on $x\n"; + break; + } +} + +print "Completed $x\n"; + +// Cleanup + +$stmtarray = array( + "drop type bug44113_list_t" +); + +foreach ($stmtarray as $stmt) { + $s = oci_parse($c, $stmt); + oci_execute($s); +} + +oci_close($c); + +echo "Done\n"; + +?> +--EXPECT-- +Completed 70000 +Done |
