--TEST-- GitHub issue 1391 - string truncation error when binding some parameters as longer strings the second time --DESCRIPTION-- The test shows the same parameters, though bound as short strings in the first insertion, can be bound as longer strings in the subsequent insertions. --ENV-- PHPT_EXEC=true --SKIPIF-- --FILE-- exec($drop); } try { $conn = new PDO("sqlsrv:server=$server; Database = $databaseName;", $uid, $pwd); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); dropTable($conn, 'long_strings'); $tsql = <<exec($tsql); $tsql = <<prepare($tsql); // Bind and execute short string values first $fourThousand = '4'; $varMax = 'v'; $nvarMax = 'n'; $stmt->bindParam(1, $fourThousand); $stmt->bindParam(2, $varMax); $stmt->bindParam(3, $nvarMax); $stmt->execute(); // Bind and execute long string values second, on same $stmt $fourThousand = str_repeat('4', 4001); $varMax = str_repeat('v', 4001); $nvarMax = str_repeat('n', 4001); $stmt->bindParam(1, $fourThousand); $stmt->bindParam(2, $varMax); $stmt->bindParam(3, $nvarMax); $stmt->execute(); // fetch the data $stmt = $conn->prepare("SELECT COUNT(*) FROM long_strings"); $stmt->execute(); $row = $stmt->fetch(PDO::FETCH_NUM); echo $row[0]."\n"; dropTable($conn, 'long_strings'); echo "Done\n"; } catch (PdoException $e) { echo $e->getMessage(); } ?> --EXPECT-- 2 Done