[PECL-CVS] [pecl-database-pdo_oci] main: Fix tests for Windows and make it platform agnostic

[email protected] (Sharad Chandran R)
Newsgroups php.pecl.cvs
Message-ID <[email protected]>
Author: Sharad Chandran R (sharadraju)
Date: 2026-01-06T12:52:42+05:30

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

Fix tests for Windows and make it platform agnostic

Changed paths:
  M  oci_driver.c
  M  tests/pdo_oci_debugdumpparams.phpt


Diff:

diff --git a/oci_driver.c b/oci_driver.c
index 3026f7c..7216fc8 100644
--- a/oci_driver.c
+++ b/oci_driver.c
@@ -27,7 +27,7 @@
 #include "php_pdo_oci_int.h"
 #include "Zend/zend_exceptions.h"
 
-static inline ub4 pdo_oci_sanitize_prefetch(long prefetch);
+static inline ub4 pdo_oci_sanitize_prefetch(zend_long prefetch);
 
 static void pdo_oci_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info) /* {{{ */
 {
@@ -879,13 +879,14 @@ const pdo_driver_t pdo_oci_driver = {
 	pdo_oci_handle_factory
 };
 
-static inline ub4 pdo_oci_sanitize_prefetch(long prefetch) /* {{{ */
+static inline ub4 pdo_oci_sanitize_prefetch(zend_long prefetch) /* {{{ */
 {
 	if (prefetch < 0) {
-		prefetch = 0;
-	} else if (prefetch > UB4MAXVAL / PDO_OCI_PREFETCH_ROWSIZE) {
-		prefetch = PDO_OCI_PREFETCH_DEFAULT;
+		return 0;
 	}
-	return ((ub4)prefetch);
+	if (prefetch > (zend_long)(UB4MAXVAL / PDO_OCI_PREFETCH_ROWSIZE)) {
+		return PDO_OCI_PREFETCH_DEFAULT;
+	}
+	return (ub4)prefetch;
 }
 /* }}} */
diff --git a/tests/pdo_oci_debugdumpparams.phpt b/tests/pdo_oci_debugdumpparams.phpt
index 6162525..d464527 100644
--- a/tests/pdo_oci_debugdumpparams.phpt
+++ b/tests/pdo_oci_debugdumpparams.phpt
@@ -26,7 +26,7 @@ $stmt = $db->query("
 var_dump($stmt->debugDumpParams());
 ?>
 --EXPECTF--
-SQL: [844]%s
+SQL: [%d]%s
     SELECT '
         Dumps the information contained by a prepared statement directly on the output. It will provide the SQL query in use, the number of parameters used (Params), the list of parameters, with their name, type (paramtype) as an integer, their key name or position, and the position in the query (if this is supported by the PDO driver, otherwise, it will be -1).
         This is a debug function, which dump directly the data on the normal output.
@@ -37,4 +37,3 @@ SQL: [844]%s
 
 Params:  0
 NULL
-
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.