]> granicus.if.org Git - php/commitdiff
Fix #78470: odbc_specialcolumns() no longer accepts $nullable
authorChristoph M. Becker <cmbecker69@gmx.de>
Thu, 24 Sep 2020 08:30:41 +0000 (10:30 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Thu, 24 Sep 2020 10:15:59 +0000 (12:15 +0200)
It is mandatory to pass either `SQL_NO_NULLS` or `SQL_NULLABLE` as
tenth parameter to `SQLSpecialColumns()`; otherwise the function call
fails.  Therefore the user must be allowed to pass the desired value
as parameter to `odbc_specialcolumns()` again.

Closes GH-6200.

NEWS
ext/odbc/php_odbc.c
ext/odbc/tests/bug78470.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 6d8ed53499e1c6e7176e3e2ac2b78f637fb27d48..35a928af07c56407d7f39502c611bc39b7db1d4c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,9 @@ PHP                                                                        NEWS
   . Fixed bug #80107 (mysqli_query() fails for ~16 MB long query when
     compression is enabled). (Nikita)
 
+- ODBC:
+  . Fixed bug #78470 (odbc_specialcolumns() no longer accepts $nullable). (cmb)
+
 - OPcache:
   . Fixed bug #80083 (Optimizer pass 6 removes variables used for ibm_db2 data
     binding). (Nikita)
index 4ba9aa2d74b32beed5154dbd2ba9be1e80a11bbd..c2d1a8f846f923d6386cf94ae026f307360574d5 100644 (file)
@@ -3668,7 +3668,7 @@ PHP_FUNCTION(odbc_specialcolumns)
        SQLUSMALLINT type, scope, nullable;
        RETCODE rc;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS(), "rls!ssl", &pv_conn, &vtype, &cat, &cat_len, &schema, &schema_len,
+       if (zend_parse_parameters(ZEND_NUM_ARGS(), "rls!ssll", &pv_conn, &vtype, &cat, &cat_len, &schema, &schema_len,
                &name, &name_len, &vscope, &vnullable) == FAILURE) {
                return;
        }
diff --git a/ext/odbc/tests/bug78470.phpt b/ext/odbc/tests/bug78470.phpt
new file mode 100644 (file)
index 0000000..6910f9b
--- /dev/null
@@ -0,0 +1,15 @@
+--TEST--
+Bug #78470 (odbc_specialcolumns() no longer accepts $nullable)
+--SKIPIF--
+<?php
+if (!extension_loaded('odbc')) die('skip odbc extension not available');
+?>
+--FILE--
+<?php
+include 'config.inc';
+
+$conn = odbc_connect($dsn, $user, $pass);
+var_dump(odbc_specialcolumns($conn, SQL_BEST_ROWID, '', '', '', SQL_SCOPE_CURROW, SQL_NO_NULLS));
+?>
+--EXPECTF--
+resource(%d) of type (odbc result)