mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-07 09:17:29 +00:00
Merge branch 'PHP-8.0'
* PHP-8.0: Fix #44643: bound parameters ignore explicit type definitions
This commit is contained in:
2 files changed
+32
-3
No files matched your search
@@ -318,9 +318,16 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p
|
||||
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
|
||||
/* MS Access, for instance, doesn't support SQLDescribeParam,
|
||||
* so we need to guess */
|
||||
sqltype = PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_LOB ?
|
||||
SQL_LONGVARBINARY :
|
||||
SQL_LONGVARCHAR;
|
||||
switch (PDO_PARAM_TYPE(param->param_type)) {
|
||||
case PDO_PARAM_INT:
|
||||
sqltype = SQL_INTEGER;
|
||||
break;
|
||||
case PDO_PARAM_LOB:
|
||||
sqltype = SQL_LONGVARBINARY;
|
||||
break;
|
||||
default:
|
||||
sqltype = SQL_LONGVARCHAR;
|
||||
}
|
||||
precision = 4000;
|
||||
scale = 5;
|
||||
nullable = 1;
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #44643 (bound parameters ignore explicit type definitions)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('pdo_odbc')) die('skip pdo_odbc extension not available');
|
||||
require 'ext/pdo/tests/pdo_test.inc';
|
||||
PDOTest::skip();
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require 'ext/pdo/tests/pdo_test.inc';
|
||||
$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
|
||||
$sql = "SELECT * FROM (SELECT 'test' = :id1) a WHERE a.test = :id2";
|
||||
$stmt = $db->prepare($sql);
|
||||
$id1 = 1;
|
||||
$stmt->bindParam(':id1', $id1, PDO::PARAM_INT);
|
||||
$id2 = 1;
|
||||
$stmt->bindParam(':id2', $id2, PDO::PARAM_INT);
|
||||
var_dump($stmt->execute());
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
Reference in new issue
Block a user