From 706c526664b0fe47d0b14982d3a887af3fc85da2 Mon Sep 17 00:00:00 2001 From: David Puglielli Date: Wed, 18 Jul 2018 16:45:10 -0700 Subject: [PATCH 1/6] Changelog updated --- CHANGELOG.md | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0794d8df..86d31a03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,36 +7,36 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) Updated PECL release packages. Here is the list of updates: ### Added -- Added support for Azure Key Vault for Always Encrypted for basic CRUD functionalities such that Always Encrypted feature is available to all supported Windows, Linux or macOS platforms -- Added support for macOS High Sierra (requires [MS ODBC Driver 17+](https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-2017)) -- Added support for Ubuntu 18.04 LTS (requires MS ODBC Driver 17.2) -- Added support for Linux and macOS for Connection Resiliency (requires MS ODBC Driver 17.2) +- Added support for Azure Key Vault for Always Encrypted functionality. Always Encrypted functionality is supported on Linux and macOS through Azure Key Vault +- Added support for connection resiliency on Linux and macOS (requires version 17.2 or higher of the [ODBC driver](https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-2017)) +- Added support for macOS High Sierra (requires version 17 or higher of the [ODBC driver](https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-2017)) +- Added support for Ubuntu 18.04 (requires version 17.2 or higher of the [ODBC driver](https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-2017)) ### Fixed -- Issue [#577](https://github.com/Microsoft/msphpsql/issues/577) - Idle Connection Resiliency doesn't work with Column Encryption enabled connection (fixed in MS ODBC Driver 17.1) -- Issue [#678](https://github.com/Microsoft/msphpsql/issues/678) - Idle Connection Resiliency doesn't work with Connection Pooling bug (fixed in MS ODBC Driver 17.1) -- Issue [#699](https://github.com/Microsoft/msphpsql/issues/699) - Binding output parameter failed when the query in the stored procedure returned no data. The test case has been added to the test lab. -- Issue [#705](https://github.com/Microsoft/msphpsql/issues/705) - Always Encrypted - Retrieving a negative decimal value (edge case) as output parameter causes truncation -- Issue [#706](https://github.com/Microsoft/msphpsql/issues/706) - Always Encrypted - Cannot insert double with precision and scale (38, 38) -- Issue [#707](https://github.com/Microsoft/msphpsql/issues/707) - Always Encrypted - Fetching decimals / numerics as output parameters bound to PDO::PARAM_BOOL or PDO::PARAM_INT returns floats, not integers -- Issue [#735](https://github.com/Microsoft/msphpsql/issues/735) - Extended the buffer size for PDO lastInsertId such that data types other than integers can be supported -- Pull Request [#759](https://github.com/Microsoft/msphpsql/pull/759) - Removed the limitation of binding a binary as inout param as PDO::PARAM_STR with SQLSRV_ENCODING_BINARY -- Pull Request [#775](https://github.com/Microsoft/msphpsql/pull/775) - Fixed the truncation problem for output params with SQL types specified as SQLSRV_SQLTYPE_DECIMAL or SQLSRV_SQLTYPE_NUMERIC +- Issue #577 - Idle Connection Resiliency doesn't work with Column Encryption enabled connections (fixed in MS ODBC Driver 17.1) +- Issue #678 - Idle Connection Resiliency doesn't work with Connection Pooling (fixed in MS ODBC Driver 17.1) +- Issue #699 - Binding output parameters fails when the query in the stored procedure returns no data. The test case has been added to the test lab. +- Issue #705 - Always Encrypted - Retrieving a negative decimal value (edge case) as output parameter causes truncation +- Issue #706 - Always Encrypted - Cannot insert double with precision and scale (38, 38) +- Issue #707 - Always Encrypted - Fetching decimals / numerics as output parameters bound to PDO::PARAM_BOOL or PDO::PARAM_INT returns floats, not integers +- Issue #735 - Extended the buffer size for PDO::lastInsertId so that data types other than integers can be supported +- Pull Request #759 - Removed the limitation of binding a binary as inout param as PDO::PARAM_STR with SQLSRV_ENCODING_BINARY +- Pull Request #775 - Fixed the truncation problem for output params with SQL types specified as SQLSRV_SQLTYPE_DECIMAL or SQLSRV_SQLTYPE_NUMERIC ### Limitations - No support for inout / output params when using sql_variant type -- In Linux and macOS, setlocale() only takes effect if it is invoked before the first connection. Attempting to set the locale after connection will not work -- Always Encrypted feature, which requires [MS ODBC Driver 17+](https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-2017) - - only Windows Certificate Store and Azure Key Vault are supported - - Issue [#716](https://github.com/Microsoft/msphpsql/issues/716) - With Always Encrypted feature enabled, Named Parameters in Sub Queries are not supported +- In Linux and macOS, setlocale() only takes effect if it is invoked before the first connection. Attempting to set the locale after connecting will not work +- Always Encrypted requires [MS ODBC Driver 17+](https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-2017) + - Only Windows Certificate Store and Azure Key Vault are supported. Custom Keystores are not supported + - Issue #716 - With Always Encrypted enabled, named parameters in subqueries are not supported - [Always Encrypted limitations](https://docs.microsoft.com/en-us/sql/connect/php/using-always-encrypted-php-drivers?view=sql-server-2017#limitations-of-the-php-drivers-when-using-always-encrypted) ### Known Issues -- Connection pooling on Linux or macOS not recommended with [unixODBC](http://www.unixodbc.org/) < 2.3.6 +- Connection pooling on Linux or macOS is not recommended with [unixODBC](http://www.unixodbc.org/) < 2.3.6 - When pooling is enabled in Linux or macOS - - unixODBC <= 2.3.4 (Linux and macOS) might not return proper diagnostics information, such as error messages, warnings and informative messages + - unixODBC <= 2.3.4 (Linux and macOS) might not return proper diagnostic information, such as error messages, warnings and informative messages - due to this unixODBC bug, fetch large data (such as xml, binary) as streams as a workaround. See the examples [here](https://github.com/Microsoft/msphpsql/wiki/Features#pooling) -- With ColumnEncryption enabled, calling stored procedures with XML parameters does not work (Issue [#674](https://github.com/Microsoft/msphpsql/issues/674)) +- With ColumnEncryption enabled, calling stored procedures with XML parameters does not work (Issue #674) ## 5.2.1-preview - 2018-06-01 Updated PECL release packages. Here is the list of updates: From 7b720e1f623eacfc8834c3de7cb2bace24ac7b6d Mon Sep 17 00:00:00 2001 From: David Puglielli Date: Wed, 18 Jul 2018 17:01:54 -0700 Subject: [PATCH 2/6] changelog updated, test skipif changed to run on unix platforms --- CHANGELOG.md | 2 +- test/functional/sqlsrv/sqlsrv_connect_encrypted.phpt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86d31a03..939a6e23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,7 +27,7 @@ Updated PECL release packages. Here is the list of updates: - No support for inout / output params when using sql_variant type - In Linux and macOS, setlocale() only takes effect if it is invoked before the first connection. Attempting to set the locale after connecting will not work - Always Encrypted requires [MS ODBC Driver 17+](https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-2017) - - Only Windows Certificate Store and Azure Key Vault are supported. Custom Keystores are not supported + - Only Windows Certificate Store and Azure Key Vault are supported. Custom Keystores are not yet supported - Issue #716 - With Always Encrypted enabled, named parameters in subqueries are not supported - [Always Encrypted limitations](https://docs.microsoft.com/en-us/sql/connect/php/using-always-encrypted-php-drivers?view=sql-server-2017#limitations-of-the-php-drivers-when-using-always-encrypted) diff --git a/test/functional/sqlsrv/sqlsrv_connect_encrypted.phpt b/test/functional/sqlsrv/sqlsrv_connect_encrypted.phpt index 5a39140e..e6a5bbb6 100644 --- a/test/functional/sqlsrv/sqlsrv_connect_encrypted.phpt +++ b/test/functional/sqlsrv/sqlsrv_connect_encrypted.phpt @@ -1,7 +1,7 @@ --TEST-- Test new connection keyword ColumnEncryption --SKIPIF-- - + --FILE-- Date: Wed, 18 Jul 2018 17:25:38 -0700 Subject: [PATCH 3/6] Fixed skipif typo --- test/functional/sqlsrv/skipif_version_less_than_2k14.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/functional/sqlsrv/skipif_version_less_than_2k14.inc b/test/functional/sqlsrv/skipif_version_less_than_2k14.inc index 431ef385..74d041ff 100644 --- a/test/functional/sqlsrv/skipif_version_less_than_2k14.inc +++ b/test/functional/sqlsrv/skipif_version_less_than_2k14.inc @@ -23,7 +23,7 @@ $msodbcsql_maj = explode(".", $msodbcsql_ver)[0]; $msodbcsql_min = explode(".", $msodbcsql_ver)[1]; if (!$is_win) { - if ($msodbcsql_maj < 17 or $msodbcslq_min < 2) { + if ($msodbcsql_maj < 17 or $msodbcsql_min < 2) { die("skip Unsupported ODBC driver version"); } } From 6cd7dbc8b9de9899300da051ddd43918ab5e1011 Mon Sep 17 00:00:00 2001 From: David Puglielli Date: Thu, 19 Jul 2018 10:59:32 -0700 Subject: [PATCH 4/6] Fixed typo in skipif for pdo --- test/functional/pdo_sqlsrv/skipif_version_less_than_2k14.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/functional/pdo_sqlsrv/skipif_version_less_than_2k14.inc b/test/functional/pdo_sqlsrv/skipif_version_less_than_2k14.inc index fefd0d34..10849b9b 100644 --- a/test/functional/pdo_sqlsrv/skipif_version_less_than_2k14.inc +++ b/test/functional/pdo_sqlsrv/skipif_version_less_than_2k14.inc @@ -21,7 +21,7 @@ $msodbcsql_maj = explode(".", $msodbcsql_ver)[0]; $msodbcsql_min = explode(".", $msodbcsql_ver)[1]; if (!$is_win) { - if ($msodbcsql_maj < 17 or $msodbcslq_min < 2) { + if ($msodbcsql_maj < 17 or $msodbcsql_min < 2) { die("skip Unsupported ODBC driver version"); } } From 820bc3199e91b9e48c014fd072da086cd8364df2 Mon Sep 17 00:00:00 2001 From: David Puglielli Date: Thu, 19 Jul 2018 12:22:02 -0700 Subject: [PATCH 5/6] Fixed some output for Travis --- test/functional/pdo_sqlsrv/pdo_connection_resiliency.phpt | 3 +-- .../pdo_sqlsrv/pdo_connection_resiliency_timeouts.phpt | 3 +-- test/functional/sqlsrv/connection_resiliency.phpt | 4 ++-- test/functional/sqlsrv/connection_resiliency_timeouts.phpt | 4 ++-- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/test/functional/pdo_sqlsrv/pdo_connection_resiliency.phpt b/test/functional/pdo_sqlsrv/pdo_connection_resiliency.phpt index 3eb8b4f6..806f899d 100644 --- a/test/functional/pdo_sqlsrv/pdo_connection_resiliency.phpt +++ b/test/functional/pdo_sqlsrv/pdo_connection_resiliency.phpt @@ -219,7 +219,6 @@ Statement 4 successful\. Statement 5 successful\. -1 rows in result set\. Error executing statement 6\. -SQLSTATE\[08S02\]: \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]TCP Provider: (An existing connection was forcibly closed by the remote host\.|Error code 0x20) -Statement 7 successful\. +SQLSTATE\[08S02\]: \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]TCP Provider: (An existing connection was forcibly closed by the remote host\.\n|Error code 0x20)Statement 7 successful\. Error executing statement 8\. SQLSTATE\[IMSSP\]: The connection cannot process this operation because there is a statement with pending results\. To make the connection available for other queries, either fetch all results or cancel or free the statement. For more information, see the product documentation about the MultipleActiveResultSets connection option. diff --git a/test/functional/pdo_sqlsrv/pdo_connection_resiliency_timeouts.phpt b/test/functional/pdo_sqlsrv/pdo_connection_resiliency_timeouts.phpt index b79705cd..08424eda 100644 --- a/test/functional/pdo_sqlsrv/pdo_connection_resiliency_timeouts.phpt +++ b/test/functional/pdo_sqlsrv/pdo_connection_resiliency_timeouts.phpt @@ -84,5 +84,4 @@ DropTables( $server, $uid, $pwd, $tableName1, $tableName2 ); ?> --EXPECTREGEX-- Error executing statement 1\. -SQLSTATE\[08S02\]: \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]TCP Provider: (An existing connection was forcibly closed by the remote host\.|Error code 0x20) -Query successfully executed\. +SQLSTATE\[08S02\]: \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]TCP Provider: (An existing connection was forcibly closed by the remote host\.\n|Error code 0x20 |SMux Provider: Physical connection is not usable \[xFFFFFFFF\]\. )Query successfully executed\. diff --git a/test/functional/sqlsrv/connection_resiliency.phpt b/test/functional/sqlsrv/connection_resiliency.phpt index ad88e923..1f01f482 100644 --- a/test/functional/sqlsrv/connection_resiliency.phpt +++ b/test/functional/sqlsrv/connection_resiliency.phpt @@ -219,8 +219,8 @@ Array \[SQLSTATE\] => 08S01 \[1\] => (10054|104) \[code\] => (10054|104) - \[2\] => \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]TCP Provider: (An existing connection was forcibly closed by the remote host\.\n|Error code 0x68) - \[message\] => \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]TCP Provider: (An existing connection was forcibly closed by the remote host\.\n|Error code 0x68) + \[2\] => \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]TCP Provider: (An existing connection was forcibly closed by the remote host\.\n|Error code 0x68|Error code 0x2746) + \[message\] => \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]TCP Provider: (An existing connection was forcibly closed by the remote host\.\n|Error code 0x68|Error code 0x2746) \) \[1\] => Array diff --git a/test/functional/sqlsrv/connection_resiliency_timeouts.phpt b/test/functional/sqlsrv/connection_resiliency_timeouts.phpt index b810d02e..be370ad7 100644 --- a/test/functional/sqlsrv/connection_resiliency_timeouts.phpt +++ b/test/functional/sqlsrv/connection_resiliency_timeouts.phpt @@ -86,8 +86,8 @@ Array \[SQLSTATE\] => 08S01 \[1\] => (10054|104) \[code\] => (10054|104) - \[2\] => \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]TCP Provider: (An existing connection was forcibly closed by the remote host\.\n|Error code 0x68) - \[message\] => \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]TCP Provider: (An existing connection was forcibly closed by the remote host\.\n|Error code 0x68) + \[2\] => \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]TCP Provider: (An existing connection was forcibly closed by the remote host\.\n|Error code 0x68|Error code 0x2746) + \[message\] => \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]TCP Provider: (An existing connection was forcibly closed by the remote host\.\n|Error code 0x68|Error code 0x2746) \) \[1\] => Array From 0f66c4848bdad1e7e0fa2ed50b74851b892277ce Mon Sep 17 00:00:00 2001 From: David Puglielli Date: Thu, 19 Jul 2018 13:25:07 -0700 Subject: [PATCH 6/6] Moved error checking inside pdo connres tests --- .../pdo_sqlsrv/pdo_connection_resiliency.phpt | 41 +++++++++++-------- ...onnection_resiliency_prepare_transact.phpt | 28 ++++++++----- .../pdo_connection_resiliency_timeouts.phpt | 12 ++++-- 3 files changed, 50 insertions(+), 31 deletions(-) diff --git a/test/functional/pdo_sqlsrv/pdo_connection_resiliency.phpt b/test/functional/pdo_sqlsrv/pdo_connection_resiliency.phpt index 806f899d..5c9fe7b2 100644 --- a/test/functional/pdo_sqlsrv/pdo_connection_resiliency.phpt +++ b/test/functional/pdo_sqlsrv/pdo_connection_resiliency.phpt @@ -161,7 +161,11 @@ try { echo $rowcount." rows in result set.\n"; } catch (PDOException $e) { echo "Error executing statement 6.\n"; - print_r($e->getMessage()); + $err = $e->getMessage(); + if (strpos($err, 'SQLSTATE[08S02]')===false or (strpos($err, 'TCP Provider')===false and strpos($err, 'SMux Provider')===false)) { + echo "Error: Wrong error message.\n"; + print_r($err); + } } unset($conn); @@ -200,25 +204,28 @@ try { } } catch (PDOException $e) { echo "Error executing statement 8.\n"; - print_r($e->getMessage()); + $err = $e->getMessage(); + if (strpos($err, 'SQLSTATE[IMSSP]')===false or strpos($err, 'The connection cannot process this operation because there is a statement with pending results')===false) { + echo "Error: Wrong error message.\n"; + print_r($err); + } } unset($conn); unset($conn_break); ?> ---EXPECTREGEX-- -Statement 1 successful\. -16 rows in result set\. -Statement 2 successful\. -9 rows in result set\. -Statement 3 successful\. --1 rows in result set\. -Statement 4 successful\. --1 rows in result set\. -Statement 5 successful\. --1 rows in result set\. -Error executing statement 6\. -SQLSTATE\[08S02\]: \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]TCP Provider: (An existing connection was forcibly closed by the remote host\.\n|Error code 0x20)Statement 7 successful\. -Error executing statement 8\. -SQLSTATE\[IMSSP\]: The connection cannot process this operation because there is a statement with pending results\. To make the connection available for other queries, either fetch all results or cancel or free the statement. For more information, see the product documentation about the MultipleActiveResultSets connection option. +--EXPECT-- +Statement 1 successful. +16 rows in result set. +Statement 2 successful. +9 rows in result set. +Statement 3 successful. +-1 rows in result set. +Statement 4 successful. +-1 rows in result set. +Statement 5 successful. +-1 rows in result set. +Error executing statement 6. +Statement 7 successful. +Error executing statement 8. diff --git a/test/functional/pdo_sqlsrv/pdo_connection_resiliency_prepare_transact.phpt b/test/functional/pdo_sqlsrv/pdo_connection_resiliency_prepare_transact.phpt index 95db2b5b..5bd5a348 100644 --- a/test/functional/pdo_sqlsrv/pdo_connection_resiliency_prepare_transact.phpt +++ b/test/functional/pdo_sqlsrv/pdo_connection_resiliency_prepare_transact.phpt @@ -190,7 +190,12 @@ try } catch ( PDOException $e ) { - print_r( $e->getMessage() ); + echo "Transaction failed.\n"; + $err = $e->getMessage(); + if (strpos($err, 'SQLSTATE[08S02]')===false or (strpos($err, 'TCP Provider')===false and strpos($err, 'SMux Provider')===false)) { + echo "Error: Wrong error message.\n"; + print_r($err); + } } // This try catch block prevents an Uncaught PDOException error that occurs @@ -201,17 +206,20 @@ try } catch ( PDOException $e ) { - print_r( $e->getMessage() ); + $err = $e->getMessage(); + if (strpos($err, 'SQLSTATE[08S01]')===false or strpos($err, 'Communication link failure')===false) { + echo "Error: Wrong error message.\n"; + print_r($err); + } } $conn_break = null; ?> ---EXPECTREGEX-- -Statement 1 prepared\. -Statement 1 executed\. -Transaction begun\. -Transaction was committed\. -Transaction begun\. -SQLSTATE\[08S02\]: \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]TCP Provider: (An existing connection was forcibly closed by the remote host\.|Error code 0x20) -SQLSTATE\[08S01\]: \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]Communication link failure +--EXPECT-- +Statement 1 prepared. +Statement 1 executed. +Transaction begun. +Transaction was committed. +Transaction begun. +Transaction failed. diff --git a/test/functional/pdo_sqlsrv/pdo_connection_resiliency_timeouts.phpt b/test/functional/pdo_sqlsrv/pdo_connection_resiliency_timeouts.phpt index 08424eda..279a7eb4 100644 --- a/test/functional/pdo_sqlsrv/pdo_connection_resiliency_timeouts.phpt +++ b/test/functional/pdo_sqlsrv/pdo_connection_resiliency_timeouts.phpt @@ -40,7 +40,11 @@ try catch( PDOException $e ) { echo "Error executing statement 1.\n"; - print_r( $e->getMessage() ); + $err = $e->getMessage(); + if (strpos($err, 'SQLSTATE[08S02]')===false or (strpos($err, 'TCP Provider')===false and strpos($err, 'SMux Provider')===false)) { + echo "Error: Wrong error message.\n"; + print_r($err); + } } $conn = null; @@ -82,6 +86,6 @@ $conn_break = null; DropTables( $server, $uid, $pwd, $tableName1, $tableName2 ); ?> ---EXPECTREGEX-- -Error executing statement 1\. -SQLSTATE\[08S02\]: \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]TCP Provider: (An existing connection was forcibly closed by the remote host\.\n|Error code 0x20 |SMux Provider: Physical connection is not usable \[xFFFFFFFF\]\. )Query successfully executed\. +--EXPECT-- +Error executing statement 1. +Query successfully executed.