diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..db797324 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +.vs +.vscode +__pycache__ +*.diff +*.exp +*.log +*.sh +*.out +test/**/**/*.php \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 3889d030..5f9183a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,33 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) +## 5.11.0-beta1 - 2023-01-25 +Updated PECL release packages. Here is the list of updates: + +### Added +- Support for PHP 8.2 + +### Fixed +- Pull request [#1408](https://github.com/microsoft/msphpsql/pull/1408) - Fixed right truncation issue, unit test added by talkinnl + +### Limitations +- No support for inout / output params when using sql_variant type +- No support for inout / output params when formatting decimal values +- 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/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server) + - Only Windows Certificate Store and Azure Key Vault are supported. Custom Keystores are not yet supported + - Issue [#716](https://github.com/Microsoft/msphpsql/issues/716) - With Always Encrypted enabled, named parameters in subqueries are not supported + - Issue [#1050](https://github.com/microsoft/msphpsql/issues/1050) - With Always Encrypted enabled, insertion requires the column list for any tables with identity columns + - [Always Encrypted limitations](https://docs.microsoft.com/sql/connect/php/using-always-encrypted-php-drivers#limitations-of-the-php-drivers-when-using-always-encrypted) + +### Known Issues +- This release requires ODBC Driver 17.4.2 or above. Otherwise, a warning about failing to set an attribute may be suppressed when using an older ODBC driver. +- Connection pooling on Linux or macOS is not recommended with [unixODBC](http://www.unixodbc.org/) < 2.3.7 +- When pooling is enabled in Linux or macOS + - 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) + + ## 5.10.1 - 2022-05-12 Updated PECL release packages. Here is the list of updates: diff --git a/README.md b/README.md index 2f75d72e..136284aa 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,13 @@ The [Microsoft Drivers for PHP for Microsoft SQL Server][phpdoc] are PHP extensions that allow for the reading and writing of SQL Server data from within PHP scripts. The SQLSRV extension provides a procedural interface while the PDO_SQLSRV extension implements PHP Data Objects (PDO) for accessing data in all editions of SQL Server 2012 and later (including Azure SQL DB). These drivers rely on the [Microsoft ODBC Driver for SQL Server][odbcdoc] to handle the low-level communication with SQL Server. -This release contains the SQLSRV and PDO_SQLSRV drivers for PHP 7.3+ with improvements on both drivers and some limitations. Upcoming [releases][releases] will contain additional functionalities, bug fixes, and more. +This release contains the SQLSRV and PDO_SQLSRV drivers for PHP 8.0+ with improvements on both drivers and some limitations. Upcoming [releases][releases] will contain additional functionalities, bug fixes, and more. ## Take our survey Thank you for taking the time to participate in the [sentiment survey](https://github.com/microsoft/msphpsql/wiki/Survey-Results). You can continue to help us improve by letting us know how we are doing and how you use [PHP][phpweb]: - +[**Click here to start the PHP survey**](https://aka.ms/mssqlphpsurvey) ### Status of Most Recent Builds | Azure Pipelines (Linux) | AppVeyor (Windows) | Coverage (Windows) | @@ -37,8 +37,8 @@ Please follow the [Getting started](https://docs.microsoft.com/sql/connect/php/g For full details on the system requirements for the drivers, see the [system requirements](https://docs.microsoft.com/sql/connect/php/system-requirements-for-the-php-sql-driver) on Microsoft Docs. On the client machine: -- 7.4.x, 8.0.x, 8.1.x -- [Microsoft ODBC Driver 17 or Microsoft ODBC Driver 13][odbcdoc] +- 8.0.x, 8.1.x, 8.2.x +- [Microsoft ODBC Driver 18, 17 or 13][odbcdoc] - If using a Web server such as Internet Information Services (IIS) or Apache, it must be configured to run PHP On the server side, Microsoft SQL Server 2012 and above on Windows are supported, as are Microsoft SQL Server 2016 and above on Linux. @@ -47,7 +47,7 @@ On the server side, Microsoft SQL Server 2012 and above on Windows are supported The drivers are distributed as pre-compiled extensions for PHP found on the [releases page][releases]. They are available in thread-safe and non-thread-safe versions, and in 32-bit (Windows only) and 64-bit versions. The source code for the drivers is also available, and you can compile them as thread safe or non-thread-safe versions. The thread safety configuration of your web server will determine which version you need. -If you choose to build the drivers, you must be able to build PHP 7.* or 8.* without including these extensions. For help building PHP on Windows, see the [official PHP website][phpbuild]. For details on compiling the drivers, see the [documentation](https://github.com/microsoft/msphpsql/blob/master/buildscripts/README.md) -- an example buildscript is provided, but you can also compile the drivers manually. +If you choose to build the drivers, you must be able to build PHP 8.* without including these extensions. For help building PHP on Windows, see the [official PHP website][phpbuild]. For details on compiling the drivers, see the [documentation](https://github.com/microsoft/msphpsql/blob/master/buildscripts/README.md) -- an example buildscript is provided, but you can also compile the drivers manually. To load the drivers, make sure that the driver is in your PHP extension directory and enable it in your PHP installation's php.ini file by adding `extension=php_sqlsrv.dll` and/or `extension=php_pdo_sqlsrv.dll` to the ini file. If necessary, specify the extension directory using `extension_dir`, for example: `extension_dir = "C:\PHP\ext"`. Note that the precompiled binaries have different names -- substitute accordingly in php.ini. For more details on loading the drivers, see [Loading the PHP SQL Driver](https://docs.microsoft.com/sql/connect/php/loading-the-php-sql-driver) on Microsoft Docs. diff --git a/appveyor.yml b/appveyor.yml index 4cf0be78..5f5e8a5c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -12,6 +12,7 @@ environment: SQLSRV_DBNAME: msphpsql_sqlsrv PDOSQLSRV_DBNAME: msphpsql_pdosqlsrv PYTHON: c:\Python36 + APPVEYOR: true # For details about Appveyor build worker images (VM template): https://www.appveyor.com/docs/build-environment/#build-worker-images matrix: - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c7b643f9..e4e5fb4a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -11,6 +11,7 @@ variables: trigger: - dev +- fix/* pr: - dev diff --git a/buildscripts/builddrivers.py b/buildscripts/builddrivers.py index 26c91c1c..37b71efe 100644 --- a/buildscripts/builddrivers.py +++ b/buildscripts/builddrivers.py @@ -200,7 +200,11 @@ class BuildDriver(object): print('Something went wrong, launching log file', logfile) # display log file only when not testing if not self.testing: - os.startfile(os.path.join(root_dir, 'php-sdk', logfile)) + logfile_path = os.path.join(root_dir, 'php-sdk', logfile) + if os.path.isfile(logfile_path): + with open(logfile_path, 'r') as f: + f.seek(0) + print(f.read()) os.chdir(work_dir) exit(1) diff --git a/buildscripts/buildtools.py b/buildscripts/buildtools.py index 58177854..89bedad1 100644 --- a/buildscripts/buildtools.py +++ b/buildscripts/buildtools.py @@ -321,7 +321,7 @@ class BuildUtil(object): else: # pdo_sqlsrv cmd_line = ' --enable-pdo --with-pdo-sqlsrv=shared ' + cmd_line - cmd_line = 'cscript configure.js --disable-all --enable-cli --enable-cgi --enable-json --enable-embed' + cmd_line + cmd_line = 'cscript configure.js --disable-all --enable-cli --enable-cgi --enable-json --enable-embed --enable-mbstring --enable-ctype' + cmd_line if self.thread == 'nts': cmd_line = cmd_line + ' --disable-zts' return cmd_line diff --git a/source/pdo_sqlsrv/config.m4 b/source/pdo_sqlsrv/config.m4 index f91d84c0..4db1ec27 100644 --- a/source/pdo_sqlsrv/config.m4 +++ b/source/pdo_sqlsrv/config.m4 @@ -4,7 +4,7 @@ dnl dnl Contents: the code that will go into the configure script, indicating options, dnl external libraries and includes, and what source files are to be compiled. dnl -dnl Microsoft Drivers 5.10 for PHP for SQL Server +dnl Microsoft Drivers 5.11 for PHP for SQL Server dnl Copyright(c) Microsoft Corporation dnl All rights reserved. dnl MIT License diff --git a/source/pdo_sqlsrv/config.w32 b/source/pdo_sqlsrv/config.w32 index 0ec718f5..82e9c2c4 100644 --- a/source/pdo_sqlsrv/config.w32 +++ b/source/pdo_sqlsrv/config.w32 @@ -3,7 +3,7 @@ // // Contents: JScript build configuration used by buildconf.bat // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/pdo_sqlsrv/pdo_dbh.cpp b/source/pdo_sqlsrv/pdo_dbh.cpp index a21686d5..6473b2e3 100644 --- a/source/pdo_sqlsrv/pdo_dbh.cpp +++ b/source/pdo_sqlsrv/pdo_dbh.cpp @@ -3,7 +3,7 @@ // // Contents: Implements the PDO object for PDO_SQLSRV // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/pdo_sqlsrv/pdo_init.cpp b/source/pdo_sqlsrv/pdo_init.cpp index 3d7d2395..e9eee035 100644 --- a/source/pdo_sqlsrv/pdo_init.cpp +++ b/source/pdo_sqlsrv/pdo_init.cpp @@ -3,7 +3,7 @@ // // Contents: initialization routines for PDO_SQLSRV // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/pdo_sqlsrv/pdo_parser.cpp b/source/pdo_sqlsrv/pdo_parser.cpp index 2574a5ad..759ad94e 100644 --- a/source/pdo_sqlsrv/pdo_parser.cpp +++ b/source/pdo_sqlsrv/pdo_parser.cpp @@ -5,7 +5,7 @@ // // Copyright Microsoft Corporation // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/pdo_sqlsrv/pdo_stmt.cpp b/source/pdo_sqlsrv/pdo_stmt.cpp index 79bac4dd..b6a75045 100644 --- a/source/pdo_sqlsrv/pdo_stmt.cpp +++ b/source/pdo_sqlsrv/pdo_stmt.cpp @@ -3,7 +3,7 @@ // // Contents: Implements the PDOStatement object for the PDO_SQLSRV // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/pdo_sqlsrv/pdo_util.cpp b/source/pdo_sqlsrv/pdo_util.cpp index 1edec362..a1b131c8 100644 --- a/source/pdo_sqlsrv/pdo_util.cpp +++ b/source/pdo_sqlsrv/pdo_util.cpp @@ -3,7 +3,7 @@ // // Contents: Utility functions used by both connection or statement functions // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/pdo_sqlsrv/php_pdo_sqlsrv.h b/source/pdo_sqlsrv/php_pdo_sqlsrv.h index 923eb20d..acd68062 100644 --- a/source/pdo_sqlsrv/php_pdo_sqlsrv.h +++ b/source/pdo_sqlsrv/php_pdo_sqlsrv.h @@ -6,7 +6,7 @@ // // Contents: Declarations for the extension // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/pdo_sqlsrv/php_pdo_sqlsrv_int.h b/source/pdo_sqlsrv/php_pdo_sqlsrv_int.h index f4915de8..16957635 100644 --- a/source/pdo_sqlsrv/php_pdo_sqlsrv_int.h +++ b/source/pdo_sqlsrv/php_pdo_sqlsrv_int.h @@ -6,7 +6,7 @@ // // Contents: Internal declarations for the extension // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/pdo_sqlsrv/template.rc b/source/pdo_sqlsrv/template.rc index 82ca2f1e..8dac3221 100644 --- a/source/pdo_sqlsrv/template.rc +++ b/source/pdo_sqlsrv/template.rc @@ -3,7 +3,7 @@ // // Contents: Version resource // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/shared/FormattedPrint.cpp b/source/shared/FormattedPrint.cpp index 972aa243..d5044524 100644 --- a/source/shared/FormattedPrint.cpp +++ b/source/shared/FormattedPrint.cpp @@ -6,7 +6,7 @@ // Contents: Contains functions for handling Windows format strings // and UTF-16 on non-Windows platforms // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/shared/FormattedPrint.h b/source/shared/FormattedPrint.h index abf89395..c9005305 100644 --- a/source/shared/FormattedPrint.h +++ b/source/shared/FormattedPrint.h @@ -4,7 +4,7 @@ // Contents: Contains functions for handling Windows format strings // and UTF-16 on non-Windows platforms // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/shared/StringFunctions.cpp b/source/shared/StringFunctions.cpp index ff9d9e58..f4a3fa05 100644 --- a/source/shared/StringFunctions.cpp +++ b/source/shared/StringFunctions.cpp @@ -3,7 +3,7 @@ // // Contents: Contains functions for handling UTF-16 on non-Windows platforms // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/shared/StringFunctions.h b/source/shared/StringFunctions.h index 2af4afab..9fef95cc 100644 --- a/source/shared/StringFunctions.h +++ b/source/shared/StringFunctions.h @@ -3,7 +3,7 @@ // // Contents: Contains functions for handling UTF-16 on non-Windows platforms // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/shared/core_conn.cpp b/source/shared/core_conn.cpp index a5f87ba3..5133ede4 100644 --- a/source/shared/core_conn.cpp +++ b/source/shared/core_conn.cpp @@ -3,7 +3,7 @@ // // Contents: Core routines that use connection handles shared between sqlsrv and pdo_sqlsrv // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/shared/core_init.cpp b/source/shared/core_init.cpp index b42e4e34..6f372231 100644 --- a/source/shared/core_init.cpp +++ b/source/shared/core_init.cpp @@ -3,7 +3,7 @@ // // Contents: common initialization routines shared by PDO and sqlsrv // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/shared/core_results.cpp b/source/shared/core_results.cpp index 3b8a9d3a..447b1202 100644 --- a/source/shared/core_results.cpp +++ b/source/shared/core_results.cpp @@ -3,7 +3,7 @@ // // Contents: Result sets // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/shared/core_sqlsrv.h b/source/shared/core_sqlsrv.h index 40da6988..8a6661b7 100644 --- a/source/shared/core_sqlsrv.h +++ b/source/shared/core_sqlsrv.h @@ -6,7 +6,7 @@ // // Contents: Core routines and constants shared by the Microsoft Drivers for PHP for SQL Server // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/shared/core_stmt.cpp b/source/shared/core_stmt.cpp index 92c7cfc7..4b673e27 100644 --- a/source/shared/core_stmt.cpp +++ b/source/shared/core_stmt.cpp @@ -3,7 +3,7 @@ // // Contents: Core routines that use statement handles shared between sqlsrv and pdo_sqlsrv // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License @@ -414,10 +414,23 @@ void core_sqlsrv_bind_param( _Inout_ sqlsrv_stmt* stmt, _In_ SQLUSMALLINT param_ } // If Always Encrypted is enabled, transfer the known param meta data if applicable, which might alter param_z for decimal types - if (stmt->conn->ce_option.enabled) { - if (param_ptr->sql_data_type == SQL_UNKNOWN_TYPE || param_ptr->column_size == SQLSRV_UNKNOWN_SIZE) { + if (stmt->conn->ce_option.enabled + && (param_ptr->sql_data_type == SQL_UNKNOWN_TYPE || param_ptr->column_size == SQLSRV_UNKNOWN_SIZE)) { // meta data parameters are always sorted based on parameter number param_ptr->copy_param_meta_ae(param_z, stmt->params_container.params_meta_ae[param_num]); + } + else { + if (Z_TYPE_P(param_z) == IS_STRING && column_size == SQLSRV_UNKNOWN_SIZE) { + size_t char_size = (encoding == SQLSRV_ENCODING_UTF8) ? sizeof(SQLWCHAR) : sizeof(char); + SQLULEN byte_len = Z_STRLEN_P(param_z) * char_size; + if (byte_len > SQL_SERVER_MAX_FIELD_SIZE) { + param_ptr->column_size = SQL_SERVER_MAX_TYPE_SIZE; + } + else { + if (param_ptr->column_size == SQLSRV_UNKNOWN_SIZE) { + param_ptr->column_size = SQL_SERVER_MAX_FIELD_SIZE / char_size; + } + } } } @@ -2272,18 +2285,6 @@ bool sqlsrv_param::derive_string_types_sizes(_In_ zval* param_z) break; } - // Derive the column size also only if it is unknown - if (column_size == SQLSRV_UNKNOWN_SIZE) { - size_t char_size = (encoding == SQLSRV_ENCODING_UTF8) ? sizeof(SQLWCHAR) : sizeof(char); - SQLULEN byte_len = Z_STRLEN_P(param_z) * char_size; - - if (byte_len > SQL_SERVER_MAX_FIELD_SIZE) { - column_size = SQL_SERVER_MAX_TYPE_SIZE; - } else { - column_size = SQL_SERVER_MAX_FIELD_SIZE / char_size; - } - } - return is_numeric; } diff --git a/source/shared/core_stream.cpp b/source/shared/core_stream.cpp index f77e5e59..fda74b74 100644 --- a/source/shared/core_stream.cpp +++ b/source/shared/core_stream.cpp @@ -3,7 +3,7 @@ // // Contents: Implementation of PHP streams for reading SQL Server data // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/shared/core_util.cpp b/source/shared/core_util.cpp index 5c79e0b9..1a340f01 100644 --- a/source/shared/core_util.cpp +++ b/source/shared/core_util.cpp @@ -5,7 +5,7 @@ // // Comments: Mostly error handling and some type handling // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/shared/globalization.h b/source/shared/globalization.h index bacfe6bf..f0f2a7f4 100644 --- a/source/shared/globalization.h +++ b/source/shared/globalization.h @@ -4,7 +4,7 @@ // Contents: Contains functions for handling Windows format strings // and UTF-16 on non-Windows platforms // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/shared/interlockedatomic.h b/source/shared/interlockedatomic.h index 517a6729..162ef338 100644 --- a/source/shared/interlockedatomic.h +++ b/source/shared/interlockedatomic.h @@ -4,7 +4,7 @@ // Contents: Contains a portable abstraction for interlocked, atomic // operations on int32_t and pointer types. // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/shared/interlockedatomic_gcc.h b/source/shared/interlockedatomic_gcc.h index 582b6710..458d7e70 100644 --- a/source/shared/interlockedatomic_gcc.h +++ b/source/shared/interlockedatomic_gcc.h @@ -4,7 +4,7 @@ // Contents: Contains a portable abstraction for interlocked, atomic // operations on int32_t and pointer types. // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/shared/interlockedslist.h b/source/shared/interlockedslist.h index ad75f975..6ae2b691 100644 --- a/source/shared/interlockedslist.h +++ b/source/shared/interlockedslist.h @@ -4,7 +4,7 @@ // Contents: Contains a portable abstraction for interlocked, singly // linked list. // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/shared/localization.hpp b/source/shared/localization.hpp index a5b1c22f..4efd0b0c 100644 --- a/source/shared/localization.hpp +++ b/source/shared/localization.hpp @@ -3,7 +3,7 @@ // // Contents: Contains portable classes for localization // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/shared/localizationimpl.cpp b/source/shared/localizationimpl.cpp index 87ed39dc..a1aeef84 100644 --- a/source/shared/localizationimpl.cpp +++ b/source/shared/localizationimpl.cpp @@ -5,7 +5,7 @@ // Must be included in one c/cpp file per binary // A build error will occur if this inclusion policy is not followed // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/shared/msodbcsql.h b/source/shared/msodbcsql.h index b8ff4019..a0ad105e 100644 --- a/source/shared/msodbcsql.h +++ b/source/shared/msodbcsql.h @@ -20,7 +20,7 @@ // pecuniary loss) arising out of the use of or inability to use // this SDK, even if Microsoft has been advised of the possibility // of such damages. -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/shared/sal_def.h b/source/shared/sal_def.h index e87b63e9..37bb713a 100644 --- a/source/shared/sal_def.h +++ b/source/shared/sal_def.h @@ -3,7 +3,7 @@ // // Contents: Contains the minimal definitions to build on non-Windows platforms // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/shared/typedefs_for_linux.h b/source/shared/typedefs_for_linux.h index 72806f2c..7f645cd4 100644 --- a/source/shared/typedefs_for_linux.h +++ b/source/shared/typedefs_for_linux.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------------------------------------------------------- // File: typedefs_for_linux.h // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/shared/version.h b/source/shared/version.h index dacbd386..5303b3ce 100644 --- a/source/shared/version.h +++ b/source/shared/version.h @@ -4,7 +4,7 @@ // File: version.h // Contents: Version number constants // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License @@ -26,8 +26,8 @@ // Increase Minor with backward compatible new functionalities and API changes. // Increase Patch for backward compatible fixes. #define SQLVERSION_MAJOR 5 -#define SQLVERSION_MINOR 10 -#define SQLVERSION_PATCH 1 +#define SQLVERSION_MINOR 11 +#define SQLVERSION_PATCH 0 #define SQLVERSION_BUILD 0 // For previews, set this constant to 1, 2 and so on. Otherwise, set it to 0 @@ -59,7 +59,7 @@ #define _FILEVERSION SQLVERSION_MAJOR,SQLVERSION_MINOR,SQLVERSION_PATCH,SQLVERSION_BUILD // PECL package version ('-' or '+' is not allowed) - to support Pickle do not use macros below -#define PHP_SQLSRV_VERSION "5.10.1" -#define PHP_PDO_SQLSRV_VERSION "5.10.1" +#define PHP_SQLSRV_VERSION "5.11.0beta1" +#define PHP_PDO_SQLSRV_VERSION "5.11.0beta1" #endif // VERSION_H diff --git a/source/shared/xplat.h b/source/shared/xplat.h index ebdb20ed..f26a09ab 100644 --- a/source/shared/xplat.h +++ b/source/shared/xplat.h @@ -3,7 +3,7 @@ // // Contents: include for definition of Windows types for non-Windows platforms // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/shared/xplat_intsafe.h b/source/shared/xplat_intsafe.h index c4d93eeb..e9193d13 100644 --- a/source/shared/xplat_intsafe.h +++ b/source/shared/xplat_intsafe.h @@ -4,7 +4,7 @@ // Contents: This module defines helper functions to prevent // integer overflow bugs. // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/shared/xplat_winerror.h b/source/shared/xplat_winerror.h index 8aad6e23..3208dcfa 100644 --- a/source/shared/xplat_winerror.h +++ b/source/shared/xplat_winerror.h @@ -3,7 +3,7 @@ // // Contents: Contains the minimal definitions to build on non-Windows platforms // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/shared/xplat_winnls.h b/source/shared/xplat_winnls.h index 6cfc9071..576a65bb 100644 --- a/source/shared/xplat_winnls.h +++ b/source/shared/xplat_winnls.h @@ -3,7 +3,7 @@ // // Contents: Contains the minimal definitions to build on non-Windows platforms // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/sqlsrv/config.m4 b/source/sqlsrv/config.m4 index f06290ea..65823f3c 100644 --- a/source/sqlsrv/config.m4 +++ b/source/sqlsrv/config.m4 @@ -4,7 +4,7 @@ dnl dnl Contents: the code that will go into the configure script, indicating options, dnl external libraries and includes, and what source files are to be compiled. dnl -dnl Microsoft Drivers 5.10 for PHP for SQL Server +dnl Microsoft Drivers 5.11 for PHP for SQL Server dnl Copyright(c) Microsoft Corporation dnl All rights reserved. dnl MIT License diff --git a/source/sqlsrv/config.w32 b/source/sqlsrv/config.w32 index 68a2d220..445392e9 100644 --- a/source/sqlsrv/config.w32 +++ b/source/sqlsrv/config.w32 @@ -3,7 +3,7 @@ // // Contents: JScript build configuration used by buildconf.bat // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/sqlsrv/conn.cpp b/source/sqlsrv/conn.cpp index 4ae1a286..d3e6cf5d 100644 --- a/source/sqlsrv/conn.cpp +++ b/source/sqlsrv/conn.cpp @@ -3,7 +3,7 @@ // // Contents: Routines that use connection handles // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/sqlsrv/init.cpp b/source/sqlsrv/init.cpp index a6f6e711..45f89b5f 100644 --- a/source/sqlsrv/init.cpp +++ b/source/sqlsrv/init.cpp @@ -2,7 +2,7 @@ // File: init.cpp // Contents: initialization routines for the extension // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/sqlsrv/php_sqlsrv.h b/source/sqlsrv/php_sqlsrv.h index b30b41c6..16c02ca6 100644 --- a/source/sqlsrv/php_sqlsrv.h +++ b/source/sqlsrv/php_sqlsrv.h @@ -8,7 +8,7 @@ // // Comments: Also contains "internal" declarations shared across source files. // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/sqlsrv/php_sqlsrv_int.h b/source/sqlsrv/php_sqlsrv_int.h index d4011d20..e6acb845 100644 --- a/source/sqlsrv/php_sqlsrv_int.h +++ b/source/sqlsrv/php_sqlsrv_int.h @@ -8,7 +8,7 @@ // // Comments: Also contains "internal" declarations shared across source files. // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/sqlsrv/stmt.cpp b/source/sqlsrv/stmt.cpp index 100273fa..fe3b6dc2 100644 --- a/source/sqlsrv/stmt.cpp +++ b/source/sqlsrv/stmt.cpp @@ -3,7 +3,7 @@ // // Contents: Routines that use statement handles // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/sqlsrv/template.rc b/source/sqlsrv/template.rc index 4d8bcc32..58e99237 100644 --- a/source/sqlsrv/template.rc +++ b/source/sqlsrv/template.rc @@ -3,7 +3,7 @@ // // Contents: Version resource // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/source/sqlsrv/util.cpp b/source/sqlsrv/util.cpp index eaa801e0..0ab00969 100644 --- a/source/sqlsrv/util.cpp +++ b/source/sqlsrv/util.cpp @@ -5,7 +5,7 @@ // // Comments: Mostly error handling and some type handling // -// Microsoft Drivers 5.10 for PHP for SQL Server +// Microsoft Drivers 5.11 for PHP for SQL Server // Copyright(c) Microsoft Corporation // All rights reserved. // MIT License diff --git a/test/bvt/pdo_sqlsrv/msdn_pdoStatement_fetch.phpt b/test/bvt/pdo_sqlsrv/msdn_pdoStatement_fetch.phpt index e65eb156..665722ab 100644 --- a/test/bvt/pdo_sqlsrv/msdn_pdoStatement_fetch.phpt +++ b/test/bvt/pdo_sqlsrv/msdn_pdoStatement_fetch.phpt @@ -8,9 +8,13 @@ fetch with all fetch styles $conn = new PDO( "sqlsrv:server=$server ; Database = $databaseName", "$uid", "$pwd"); print( "\n---------- PDO::FETCH_CLASS -------------\n" ); - $stmt = $conn->query( "select * from HumanResources.Department order by GroupName" ); + $stmt = $conn->query( "select DepartmentID, Name, GroupName from HumanResources.Department order by GroupName" ); class cc { + public $DepartmentID; + public $Name; + public $GroupName; + function __construct( $arg ) { echo "$arg"; } @@ -26,7 +30,7 @@ fetch with all fetch styles } print( "\n---------- PDO::FETCH_INTO -------------\n" ); - $stmt = $conn->query( "select * from HumanResources.Department order by GroupName" ); + $stmt = $conn->query( "select DepartmentID, Name, GroupName from HumanResources.Department order by GroupName" ); $c_obj = new cc( '' ); $stmt->setFetchMode(PDO::FETCH_INTO, $c_obj); diff --git a/test/bvt/pdo_sqlsrv/msdn_pdoStatement_fetchAll.phpt b/test/bvt/pdo_sqlsrv/msdn_pdoStatement_fetchAll.phpt index 1d85aef6..88eb8700 100644 --- a/test/bvt/pdo_sqlsrv/msdn_pdoStatement_fetchAll.phpt +++ b/test/bvt/pdo_sqlsrv/msdn_pdoStatement_fetchAll.phpt @@ -25,6 +25,10 @@ fetches the rows in a result set in an array print "\n-----------\n"; class cc { + public $ContactTypeID; + public $Name; + public $ModifiedDate; + function __construct( $arg ) { echo "$arg\n"; } @@ -34,7 +38,7 @@ fetches the rows in a result set in an array } }; - $stmt = $conn->query( 'SELECT TOP(2) * FROM Person.ContactType' ); + $stmt = $conn->query( 'SELECT TOP(2) ContactTypeID, Name, ModifiedDate FROM Person.ContactType' ); $all = $stmt->fetchAll( PDO::FETCH_CLASS, 'cc', array( 'Hi!' )); var_dump( $all ); diff --git a/test/bvt/pdo_sqlsrv/msdn_pdo_query.phpt b/test/bvt/pdo_sqlsrv/msdn_pdo_query.phpt index 15a85b18..9d2490a2 100644 --- a/test/bvt/pdo_sqlsrv/msdn_pdo_query.phpt +++ b/test/bvt/pdo_sqlsrv/msdn_pdo_query.phpt @@ -26,9 +26,13 @@ while ( $row = $stmt->fetch() ){ } echo "\n........ query with a new class ............\n"; -$query = 'select * from HumanResources.Department order by GroupName'; +$query = 'select DepartmentID, Name, GroupName from HumanResources.Department order by GroupName'; // query with a class class cc { + public $DepartmentID; + public $Name; + public $GroupName; + function __construct( $arg ) { echo "$arg"; } diff --git a/test/bvt/sqlsrv/msdn_sqlsrv_connect_utf8.phpt b/test/bvt/sqlsrv/msdn_sqlsrv_connect_utf8.phpt index b6b35d2a..c965aa8d 100644 --- a/test/bvt/sqlsrv/msdn_sqlsrv_connect_utf8.phpt +++ b/test/bvt/sqlsrv/msdn_sqlsrv_connect_utf8.phpt @@ -25,7 +25,7 @@ $tsql1 = "UPDATE Production.ProductReview // $reviewID = 3; -$comments = utf8_encode("testing 1, 2, 3, 4. Testing."); +$comments = mb_convert_encoding("testing 1, 2, 3, 4. Testing.", 'ISO-8859-1', 'UTF-8'); $params1 = array( array( $comments, null ), array( $reviewID, null ) diff --git a/test/bvt/sqlsrv/msdn_sqlsrv_fetch_object_2.phpt b/test/bvt/sqlsrv/msdn_sqlsrv_fetch_object_2.phpt index 73f2ea13..0370d3a9 100644 --- a/test/bvt/sqlsrv/msdn_sqlsrv_fetch_object_2.phpt +++ b/test/bvt/sqlsrv/msdn_sqlsrv_fetch_object_2.phpt @@ -7,6 +7,8 @@ retrieves each row of a result set as an instance of the Product class defined i /* Define the Product class. */ class Product { + + /* Constructor */ public function ProductConstruct($ID) { @@ -17,6 +19,8 @@ class Product public $StockedQty; public $SafetyStockLevel; private $UnitPrice; + public $Name; + public $Color; function getPrice() { return $this->UnitPrice; diff --git a/test/bvt/sqlsrv/msdn_sqlsrv_query_utf8.phpt b/test/bvt/sqlsrv/msdn_sqlsrv_query_utf8.phpt index b0779295..d035ca75 100644 --- a/test/bvt/sqlsrv/msdn_sqlsrv_query_utf8.phpt +++ b/test/bvt/sqlsrv/msdn_sqlsrv_query_utf8.phpt @@ -27,7 +27,7 @@ $tsql1 = "UPDATE Production.ProductReview // utf8_encode to simulate an application that uses UTF-8 encoded data. // $reviewID = 3; -$comments = utf8_encode("testing"); +$comments = mb_convert_encoding("testing", 'ISO-8859-1', 'UTF-8'); $params1 = array( array($comments, SQLSRV_PARAM_IN, diff --git a/test/functional/pdo_sqlsrv/MsCommon_mid-refactor.inc b/test/functional/pdo_sqlsrv/MsCommon_mid-refactor.inc index 5c120200..6d0c4c24 100644 --- a/test/functional/pdo_sqlsrv/MsCommon_mid-refactor.inc +++ b/test/functional/pdo_sqlsrv/MsCommon_mid-refactor.inc @@ -7,7 +7,7 @@ Common functions (shared by all tests). */ - +error_reporting( ~E_DEPRECATED ); $tvpIncPath = dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'inc'.DIRECTORY_SEPARATOR; require_once($tvpIncPath. 'test_tvp_data.php'); @@ -1840,4 +1840,4 @@ function compareResourceToInput($actual, $expected) } return $matched; -} +} \ No newline at end of file diff --git a/test/functional/pdo_sqlsrv/PDO31_Statement.phpt b/test/functional/pdo_sqlsrv/PDO31_Statement.phpt index f082113c..adb1ab2a 100644 --- a/test/functional/pdo_sqlsrv/PDO31_Statement.phpt +++ b/test/functional/pdo_sqlsrv/PDO31_Statement.phpt @@ -59,6 +59,7 @@ function ExecStmt() EndTest($testName); } +#[AllowDynamicProperties] class Test { function __construct($name = 'N/A') diff --git a/test/functional/pdo_sqlsrv/PDO37_FetchMode.phpt b/test/functional/pdo_sqlsrv/PDO37_FetchMode.phpt index 5067ea90..34e6c7d2 100644 --- a/test/functional/pdo_sqlsrv/PDO37_FetchMode.phpt +++ b/test/functional/pdo_sqlsrv/PDO37_FetchMode.phpt @@ -48,6 +48,7 @@ function FetchMode() EndTest($testName); } +#[AllowDynamicProperties] class Test { function __construct($name = 'N/A') diff --git a/test/functional/pdo_sqlsrv/PDO47_FetchClass.phpt b/test/functional/pdo_sqlsrv/PDO47_FetchClass.phpt index 3a40b5b6..f4c8b298 100644 --- a/test/functional/pdo_sqlsrv/PDO47_FetchClass.phpt +++ b/test/functional/pdo_sqlsrv/PDO47_FetchClass.phpt @@ -72,6 +72,7 @@ function FetchAll() EndTest($testName); } +#[AllowDynamicProperties] class Test1 { public function __construct() @@ -80,6 +81,7 @@ class Test1 } } +#[AllowDynamicProperties] class Test2 { public function __construct() @@ -88,6 +90,7 @@ class Test2 } } +#[AllowDynamicProperties] class Test3 { public function __construct() diff --git a/test/functional/pdo_sqlsrv/PDO49_FetchFunc.phpt b/test/functional/pdo_sqlsrv/PDO49_FetchFunc.phpt index 43e9b6c8..b9398ff6 100644 --- a/test/functional/pdo_sqlsrv/PDO49_FetchFunc.phpt +++ b/test/functional/pdo_sqlsrv/PDO49_FetchFunc.phpt @@ -64,6 +64,7 @@ function FetchAll() EndTest($testName); } +#[AllowDynamicProperties] class DerivedStatement extends PDOStatement { private function __construct($name, $conn) @@ -78,6 +79,7 @@ class DerivedStatement extends PDOStatement } } +#[AllowDynamicProperties] class Test1 { public function __construct($id, $val) diff --git a/test/functional/pdo_sqlsrv/PDO50_FetchObject.phpt b/test/functional/pdo_sqlsrv/PDO50_FetchObject.phpt index c925323b..ce777ac5 100644 --- a/test/functional/pdo_sqlsrv/PDO50_FetchObject.phpt +++ b/test/functional/pdo_sqlsrv/PDO50_FetchObject.phpt @@ -10,6 +10,7 @@ PHPT_EXEC=true protocol(); $args = func_get_args(); - return (call_user_func_array(array($this, 'parent::__construct'), $args)); + $callable = parent::class . '::__construct'; + return (call_user_func_array($callable, $args)); } public function exec(string $args1) : int|false { $this->protocol(); $args = func_get_args(); - return (call_user_func_array(array($this, 'parent::exec'), $args)); + $callable = parent::class . '::exec'; + return (call_user_func_array($callable, $args)); } function query(string $sql, ?int $fetchMode = null, mixed ...$fetchModeArgs): PDOStatement|false { $this->protocol(); $args = func_get_args(); - return (call_user_func_array(array($this, 'parent::query'), $args)); + $callable = parent::class . '::query'; + return (call_user_func_array($callable, $args)); } public function __call($method, $args) diff --git a/test/functional/pdo_sqlsrv/pdo_1391_string_truncation_after_short_string.phpt b/test/functional/pdo_sqlsrv/pdo_1391_string_truncation_after_short_string.phpt new file mode 100644 index 00000000..e11ffd48 --- /dev/null +++ b/test/functional/pdo_sqlsrv/pdo_1391_string_truncation_after_short_string.phpt @@ -0,0 +1,77 @@ +--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 diff --git a/test/functional/pdo_sqlsrv/pdo_azure_ad_managed_identity.phpt b/test/functional/pdo_sqlsrv/pdo_azure_ad_managed_identity.phpt index 03856d90..12748c35 100644 --- a/test/functional/pdo_sqlsrv/pdo_azure_ad_managed_identity.phpt +++ b/test/functional/pdo_sqlsrv/pdo_azure_ad_managed_identity.phpt @@ -3,7 +3,11 @@ Test some error conditions of Azure AD Managed Identity support --DESCRIPTION-- This test expects certain exceptions to be thrown under some conditions. --SKIPIF-- - + --FILE-- getMessage()); + echo "\n"; } } catch(PDOException $e) { print_r($e->getMessage()); @@ -72,7 +78,9 @@ function connectInvalidServerWithUser() $conn = new PDO("sqlsrv:server = invalidServer; $connectionInfo", $user, null); echo $message . $testCase . PHP_EOL; } catch(PDOException $e) { - // TODO: check the exception message here + echo "Failed to connect\n"; + print_r($e->getMessage()); + echo "\n"; } } catch(PDOException $e) { print_r($e->getMessage()); @@ -82,10 +90,15 @@ function connectInvalidServerWithUser() require_once('MsSetup.inc'); // Make a connection to an invalid server +// Expect to get two error messages connectInvalidServer(); connectInvalidServerWithUser(); echo "Done\n"; ?> --EXPECT-- +Failed to connect +SQLSTATE[08001]: [Microsoft][ODBC Driver 17 for SQL Server]Named Pipes Provider: Could not open a connection to SQL Server [53]. +Failed to connect +SQLSTATE[08001]: [Microsoft][ODBC Driver 17 for SQL Server]Named Pipes Provider: Could not open a connection to SQL Server [53]. Done diff --git a/test/functional/pdo_sqlsrv/pdo_connect_driver.phpt b/test/functional/pdo_sqlsrv/pdo_connect_driver.phpt index 620e74d9..d5fa24e9 100644 --- a/test/functional/pdo_sqlsrv/pdo_connect_driver.phpt +++ b/test/functional/pdo_sqlsrv/pdo_connect_driver.phpt @@ -22,7 +22,6 @@ $conn = null; testValidValues(); testInvalidValues(); testEncryptedWithODBC(); -testWrongODBC(); echo "Done" . PHP_EOL; // end test @@ -118,17 +117,6 @@ function testEncryptedWithODBC() connectVerifyOutput($connectionOptions, "Using ODBC 13 for AE", $expected); } -function testWrongODBC() -{ - global $msodbcsqlMaj; - - $value = "ODBC Driver 18 for SQL Server"; - $connectionOptions = "Driver = $value;"; - $expected = "The specified ODBC Driver is not found."; - - connectVerifyOutput($connectionOptions, "Connect with ODBC 18", $expected); -} - ?> --EXPECT-- Done diff --git a/test/functional/pdo_sqlsrv/pdo_fetch_fetchinto_query_args.phpt b/test/functional/pdo_sqlsrv/pdo_fetch_fetchinto_query_args.phpt index 50a5cf1a..0aa66410 100644 --- a/test/functional/pdo_sqlsrv/pdo_fetch_fetchinto_query_args.phpt +++ b/test/functional/pdo_sqlsrv/pdo_fetch_fetchinto_query_args.phpt @@ -8,6 +8,8 @@ This test should not use temporary table as it might occasionally cause deadlock (msodbcsql1[1-9].dll|(libmsodbcsql-[0-9]{2}\.[0-9]\.so\.[0-9]\.[0-9]|libmsodbcsql.[0-9]{2}.dylib)) + \[(DriverDllName|DriverName)\] => (msodbcsql1[1-9].dll|(libmsodbcsql-[0-9]{2}\.[0-9]{1,2}\.so\.[0-9]\.[0-9]|libmsodbcsql.[0-9]{2}.dylib)) \[DriverODBCVer\] => [0-9]{1,2}\.[0-9]{1,2} \[DriverVer\] => [0-9]{1,2}\.[0-9]{1,2}\.[0-9]{4} \[ExtensionVer\] => [0-9]\.[0-9]+\.[0-9](-(RC[1-9]?|beta[1-9]))?(\.[0-9]+)?(\+[0-9]+)? diff --git a/test/functional/pdo_sqlsrv/pdo_get_set_attr.phpt b/test/functional/pdo_sqlsrv/pdo_get_set_attr.phpt index 37178afe..af121a68 100644 --- a/test/functional/pdo_sqlsrv/pdo_get_set_attr.phpt +++ b/test/functional/pdo_sqlsrv/pdo_get_set_attr.phpt @@ -125,7 +125,7 @@ SQLSTATE\[IMSSP\]: A read-only attribute was designated on the PDO object. Get Result PDO::ATTR_CLIENT_VERSION : array\(4\) { \[\"(DriverDllName|DriverName)\"\]=> - (string\([0-9]+\) \"msodbcsql1[1-9].dll\"|string\([0-9]+\) \"(libmsodbcsql-[0-9]{2}\.[0-9]\.so\.[0-9]\.[0-9]|libmsodbcsql.[0-9]{2}.dylib)\") + (string\([0-9]+\) \"msodbcsql1[1-9].dll\"|string\([0-9]+\) \"(libmsodbcsql-[0-9]{2}\.[0-9]{1,2}\.so\.[0-9]\.[0-9]|libmsodbcsql.[0-9]{2}.dylib)\") \["DriverODBCVer"\]=> string\(5\) \"[0-9]{1,2}\.[0-9]{1,2}\" \["DriverVer"\]=> diff --git a/test/functional/pdo_sqlsrv/pdo_simple_update_variants.phpt b/test/functional/pdo_sqlsrv/pdo_simple_update_variants.phpt index 86c5e3a7..f9636190 100644 --- a/test/functional/pdo_sqlsrv/pdo_simple_update_variants.phpt +++ b/test/functional/pdo_sqlsrv/pdo_simple_update_variants.phpt @@ -8,6 +8,7 @@ ORDER BY should work with sql_variants __construct(\(\)|\('sqlsrv:Server=l\.\.\.', 'sa', 'Sunshine4u'\)) +#0 .+(\/|\\)pdo_utf8_conn\.php\([0-9]+\): PDO->__construct(\(\)|\('sqlsrv:Server=l\.\.\.', 'sa', ('Sunshine4u'|Object\(SensitiveParameterValue\))\)) #1 {main} thrown in .+(\/|\\)pdo_utf8_conn\.php on line [0-9]+ diff --git a/test/functional/pdo_sqlsrv/skipif_Appveyor.inc b/test/functional/pdo_sqlsrv/skipif_Appveyor.inc new file mode 100644 index 00000000..f757973c --- /dev/null +++ b/test/functional/pdo_sqlsrv/skipif_Appveyor.inc @@ -0,0 +1,4 @@ + - (string\([0-9]+\) \"msodbcsql1[1-9].dll\"|string\([0-9]+\) \"(libmsodbcsql-[0-9]{2}\.[0-9]\.so\.[0-9]\.[0-9]|libmsodbcsql.[0-9]{2}.dylib)\") + (string\([0-9]+\) \"msodbcsql1[1-9].dll\"|string\([0-9]+\) \"(libmsodbcsql-[0-9]{2}\.[0-9]{1,2}\.so\.[0-9]\.[0-9]|libmsodbcsql.[0-9]{2}.dylib)\") \[\"DriverODBCVer\"\]=> string\(5\) \"[0-9]{1,2}\.[0-9]{1,2}\" \[\"DriverVer\"\]=> diff --git a/test/functional/sqlsrv/sqlsrv_connect_driver.phpt b/test/functional/sqlsrv/sqlsrv_connect_driver.phpt index 24ae97e8..12a209fe 100644 --- a/test/functional/sqlsrv/sqlsrv_connect_driver.phpt +++ b/test/functional/sqlsrv/sqlsrv_connect_driver.phpt @@ -20,7 +20,6 @@ sqlsrv_close($conn); testValidValues($msodbcsqlMaj, $server, $connectionOptions); testInvalidValues($msodbcsqlMaj, $server, $connectionOptions); testEncryptedWithODBC($msodbcsqlMaj, $server, $connectionOptions); -testWrongODBC($msodbcsqlMaj, $server, $connectionOptions); echo "Done\n"; // end test @@ -115,15 +114,6 @@ function testEncryptedWithODBC($msodbcsqlMaj, $server, $connectionOptions) connectVerifyOutput($server, $connectionOptions, "Using ODBC 13 for AE", $expected); } -function testWrongODBC($msodbcsqlMaj, $server, $connectionOptions) -{ - $value = "ODBC Driver 18 for SQL Server"; - $connectionOptions['Driver']=$value; - $expected = "The specified ODBC Driver is not found."; - - connectVerifyOutput($server, $connectionOptions, "Connect with ODBC 18", $expected); -} - ?> --EXPECT-- Done diff --git a/test/functional/sqlsrv/sqlsrv_data_classification.phpt b/test/functional/sqlsrv/sqlsrv_data_classification.phpt index ab06cce6..eab60269 100644 --- a/test/functional/sqlsrv/sqlsrv_data_classification.phpt +++ b/test/functional/sqlsrv/sqlsrv_data_classification.phpt @@ -61,7 +61,7 @@ function isDataClassSupported($conn, &$driverCapable) // ODBC Driver must be 17.2 or above $driverCapable = true; - if ($version[0] < 17 || $version[1] < 2) { + if ($version[0] < 17 || ($version[0] == 17 && $version[1] < 2)) { $driverCapable = false; return false; } diff --git a/test/functional/sqlsrv/sqlsrv_data_classification_ranks.phpt b/test/functional/sqlsrv/sqlsrv_data_classification_ranks.phpt index c79f302b..6763c300 100644 --- a/test/functional/sqlsrv/sqlsrv_data_classification_ranks.phpt +++ b/test/functional/sqlsrv/sqlsrv_data_classification_ranks.phpt @@ -63,7 +63,7 @@ function isDataClassSupported($conn, &$driverCapable) // ODBC Driver must be 17.2 or above $driverCapable = true; - if ($version[0] < 17 || $version[1] < 2) { + if ($version[0] < 17 || ($version[0] == 17 && $version[1] < 2)) { $driverCapable = false; return false; } diff --git a/test/functional/sqlsrv/sqlsrv_fetch_object.phpt b/test/functional/sqlsrv/sqlsrv_fetch_object.phpt index 857b645b..74501782 100644 --- a/test/functional/sqlsrv/sqlsrv_fetch_object.phpt +++ b/test/functional/sqlsrv/sqlsrv_fetch_object.phpt @@ -5,6 +5,7 @@ Test for fetch_object --FILE-- --FILE--