diff --git a/ODBC 17 binaries preview/README.md b/ODBC 17 binaries preview/README.md index 6b79f14d..c1a0a405 100644 --- a/ODBC 17 binaries preview/README.md +++ b/ODBC 17 binaries preview/README.md @@ -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). diff --git a/source/pdo_sqlsrv/pdo_dbh.cpp b/source/pdo_sqlsrv/pdo_dbh.cpp index 80a99b7f..c0a7ea4f 100644 --- a/source/pdo_sqlsrv/pdo_dbh.cpp +++ b/source/pdo_sqlsrv/pdo_dbh.cpp @@ -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++ ] = '\''; diff --git a/test/functional/pdo_sqlsrv/pdo_538_quote_nul.phpt b/test/functional/pdo_sqlsrv/pdo_538_quote_nul.phpt new file mode 100644 index 00000000..a636c7fc --- /dev/null +++ b/test/functional/pdo_sqlsrv/pdo_538_quote_nul.phpt @@ -0,0 +1,28 @@ +--TEST-- +Test the PDO::quote() method with a string containing '\0' character +--SKIPIF-- + +--FILE-- +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' \ No newline at end of file