Skip to content

Commit 610e7d2

Browse files
committed
Fix #78470: odbc_specialcolumns() no longer accepts $nullable
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.
1 parent 2576c57 commit 610e7d2

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ PHP NEWS
1212
. Fixed bug #80107 (mysqli_query() fails for ~16 MB long query when
1313
compression is enabled). (Nikita)
1414

15+
- ODBC:
16+
. Fixed bug #78470 (odbc_specialcolumns() no longer accepts $nullable). (cmb)
17+
1518
- OPcache:
1619
. Fixed bug #80083 (Optimizer pass 6 removes variables used for ibm_db2 data
1720
binding). (Nikita)

ext/odbc/php_odbc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3668,7 +3668,7 @@ PHP_FUNCTION(odbc_specialcolumns)
36683668
SQLUSMALLINT type, scope, nullable;
36693669
RETCODE rc;
36703670

3671-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rls!ssl", &pv_conn, &vtype, &cat, &cat_len, &schema, &schema_len,
3671+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rls!ssll", &pv_conn, &vtype, &cat, &cat_len, &schema, &schema_len,
36723672
&name, &name_len, &vscope, &vnullable) == FAILURE) {
36733673
return;
36743674
}

ext/odbc/tests/bug78470.phpt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
Bug #78470 (odbc_specialcolumns() no longer accepts $nullable)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('odbc')) die('skip odbc extension not available');
6+
?>
7+
--FILE--
8+
<?php
9+
include 'config.inc';
10+
11+
$conn = odbc_connect($dsn, $user, $pass);
12+
var_dump(odbc_specialcolumns($conn, SQL_BEST_ROWID, '', '', '', SQL_SCOPE_CURROW, SQL_NO_NULLS));
13+
?>
14+
--EXPECTF--
15+
resource(%d) of type (odbc result)

0 commit comments

Comments
 (0)