Merge branch 'dev' into missingDriver

This commit is contained in:
Jenny Tam 2017-09-29 11:37:05 -07:00
commit 302f8540c8
3 changed files with 36 additions and 5 deletions

View file

@ -1,3 +1,6 @@
The ODBC driver 17 preview binaries in this directory are required in order to use Always Encrypted (AE) functionality. Please note that these drivers should be considered to be preview versions -- they should not be used in production and are not supported by Microsoft. They will be replaced upon the official release of ODBC driver 17.
To install on Windows, simply run the msi. For instructions on installing the binaries on Linux platforms, please see [this page](https://github.com/Microsoft/msphpsql/wiki/Install-and-configuration#odbc-17-linux-installation).
The ODBC driver 17 preview binaries in this directory are required in order to use Always Encrypted functionality. Please note that these drivers should be considered to be preview versions -- they should not be used in production and are not supported by Microsoft. They will be replaced upon the official release of ODBC driver 17.
On Windows, the ODBC 17 preview binaries require the Visual C/C++ 2013 runtime libraries installed separately. These are installed with the [Visual Studio C++ 2013 Redistributable](https://www.microsoft.com/en-ca/download/details.aspx?id=40784) or with the [SQL Server command line utilities](https://www.microsoft.com/en-ca/download/details.aspx?id=53591). Once you have these, simply run the msi to install.
For instructions on installing the binaries on Linux platforms, please see [this page](https://github.com/Microsoft/msphpsql/wiki/Install-and-configuration#odbc-17-linux-installation).

View file

@ -1463,7 +1463,7 @@ int pdo_sqlsrv_dbh_quote( _Inout_ pdo_dbh_t* dbh, _In_reads_(unquoted_len) const
if ( encoding == SQLSRV_ENCODING_UTF8 ) {
quotes_needed = 3;
}
for ( size_t index = 0; index < unquoted_len && unquoted[ index ] != '\0'; ++index ) {
for ( size_t index = 0; index < unquoted_len; ++index ) {
if ( unquoted[ index ] == '\'' ) {
++quotes_needed;
}
@ -1480,7 +1480,7 @@ int pdo_sqlsrv_dbh_quote( _Inout_ pdo_dbh_t* dbh, _In_reads_(unquoted_len) const
// insert initial quote
( *quoted )[ out_current++ ] = '\'';
for ( size_t index = 0; index < unquoted_len && unquoted[ index ] != '\0'; ++index ) {
for ( size_t index = 0; index < unquoted_len; ++index ) {
if ( unquoted[ index ] == '\'' ) {
( *quoted )[ out_current++ ] = '\'';
( *quoted )[ out_current++ ] = '\'';

View file

@ -0,0 +1,28 @@
--TEST--
Test the PDO::quote() method with a string containing '\0' character
--SKIPIF--
<?php require('skipif.inc'); ?>
--FILE--
<?php
require_once 'MsCommon.inc';
try
{
$connection = connect();
$str = "XX\0XX";
print("Original: " . str_replace("\0", "{NUL}", $str) . "\n");
$str = $connection->quote($str);
print("Quoted: " . str_replace("\0", "{NUL}", $str) . "\n");
}
catch( PDOException $e ) {
die("Connection error: " . $e->getMessage());
}
?>
--EXPECT--
Original: XX{NUL}XX
Quoted: 'XX{NUL}XX'