[PECL-CVS] [pecl-database-pdo_oci] pdo_oci_blob_fetchall_fix: Merge branch 'main' into pdo_oci_blob_fetchall_fix

[email protected] (Sharad Chandran R) Wed, 7 Jan 2026 06:25:28 +0000
Newsgroups php.pecl.cvs
Message-ID <[email protected]>
Author: Sharad Chandran R (sharadraju)
Date: 2026-01-07T09:44:00+05:30

Commit: https://github.com/php/pecl-database-pdo_oci/commit/57a779ba6bd38b4c3e77e1d32a2950d4504c088b
Raw diff: https://github.com/php/pecl-database-pdo_oci/commit/57a779ba6bd38b4c3e77e1d32a2950d4504c088b.diff

Merge branch 'main' into pdo_oci_blob_fetchall_fix

Changed paths:
  A  tests/pdo_oci_bind_input_output.phpt
  M  CREDITS
  M  oci_statement.c


Diff:

diff --git a/CREDITS b/CREDITS
index 8d9f86c..38e959c 100644
--- a/CREDITS
+++ b/CREDITS
@@ -2,3 +2,4 @@ Oracle (OCI) driver for PDO
 Wez Furlong
 Michael Voříšek
 Ashutosh Agrawal
+Niels Dossche
\ No newline at end of file
diff --git a/oci_statement.c b/oci_statement.c
index 440055b..5f8f062 100644
--- a/oci_statement.c
+++ b/oci_statement.c
@@ -278,7 +278,7 @@ static sb4 oci_bind_output_cb(dvoid *ctx, OCIBind *bindp, ub4 iter, ub4 index, d
 
 	zval_ptr_dtor(parameter);
 
-	Z_STR_P(parameter) = zend_string_alloc(param->max_value_len, 1);
+	ZVAL_NEW_STR(parameter, zend_string_alloc(param->max_value_len, false));
 	P->used_for_output = 1;
 
 	P->actual_len = (ub4) Z_STRLEN_P(parameter);
@@ -397,7 +397,8 @@ static int oci_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *pa
 						zval_ptr_dtor_str(parameter);
 						ZVAL_UNDEF(parameter);
 					} else if (Z_TYPE_P(parameter) == IS_STRING) {
-						Z_STR_P(parameter) = zend_string_init(Z_STRVAL_P(parameter), P->actual_len, 1);
+						ZVAL_STR(parameter, zend_string_truncate(Z_STR_P(parameter), P->actual_len, false));
+						Z_STRVAL_P(parameter)[Z_STRLEN_P(parameter)] = '\0';
 					}
 				} else if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_LOB && P->thing) {
 					php_stream *stm;
diff --git a/tests/pdo_oci_bind_input_output.phpt b/tests/pdo_oci_bind_input_output.phpt
new file mode 100644
index 0000000..3110f10
--- /dev/null
+++ b/tests/pdo_oci_bind_input_output.phpt
@@ -0,0 +1,34 @@
+--TEST--
+PDO_OCI: Test input/output parameter binding
+--EXTENSIONS--
+pdo
+pdo_oci
+--SKIPIF--
+<?php
+require(getenv('PDO_TEST_DIR').'/pdo_test.inc');
+PDOTest::skip();
+?>
+--FILE--
+<?php
+
+require_once(getenv('PDO_TEST_DIR').'/pdo_test.inc');
+
+$dbh = PDOTest::factory();
+$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+$dbh->setAttribute(PDO::ATTR_AUTOCOMMIT, false);
+
+$sql = <<<SQL
+    begin
+        :p := :p + 100;
+    end;
+SQL;
+
+$stmt = $dbh->prepare($sql);
+$p = -1;
+$stmt->bindParam(':p', $p, PDO::PARAM_INT | PDO::PARAM_INPUT_OUTPUT, 10);
+$stmt->execute();
+var_dump($p);
+
+?>
+--EXPECT--
+string(2) "99"