Skip to content

Commit e7e7a8d

Browse files
authored
Merge pull request #1221 from microsoft/dev
5.9.0-beta2
2 parents d92cc3d + 61f3403 commit e7e7a8d

39 files changed

+999
-262
lines changed

.travis.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
sudo: required
22

33
os: linux
4-
dist: trusty
4+
dist: bionic
55

66
group: edge
77

@@ -20,10 +20,10 @@ env:
2020
- TEST_PHP_SQL_PWD=Password123
2121

2222
before_install:
23-
- docker pull mcr.microsoft.com/mssql/server:2019-latest
23+
- docker pull mcr.microsoft.com/mssql/server:2017-latest
2424

2525
install:
26-
- docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=Password123' -p 1433:1433 --name=$TEST_PHP_SQL_SERVER -d mcr.microsoft.com/mssql/server:2019-latest
26+
- docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=Password123' -p 1433:1433 --name=$TEST_PHP_SQL_SERVER -d mcr.microsoft.com/mssql/server:2017-latest
2727
- docker build --build-arg PHPSQLDIR=$PHPSQLDIR -t msphpsql-dev -f Dockerfile-msphpsql .
2828

2929
before_script:
@@ -43,7 +43,6 @@ script:
4343
- docker exec client bash -c 'for f in ./test/functional/pdo_sqlsrv/*.out; do ls $f 2>/dev/null; cat $f 2>/dev/null; done || true'
4444
- docker exec client python ./test/functional/setup/cleanup_dbs.py -dbname $SQLSRV_DBNAME
4545
- docker exec client python ./test/functional/setup/cleanup_dbs.py -dbname $PDOSQLSRV_DBNAME
46-
- docker exec client coveralls -i ./source/ -e ./source/shared/ -e ./test/ --gcov-options '\-lp'
4746
- docker stop client
4847
- docker ps -a
4948

CHANGELOG.md

+32
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,38 @@ All notable changes to this project will be documented in this file.
33

44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55

6+
## 5.9.0-beta2 - 2020-12-02
7+
Updated PECL release packages. Here is the list of updates:
8+
9+
### Added
10+
- Support for PHP 8.0
11+
12+
### Removed
13+
- Dropped support for PHP 7.2
14+
15+
### Fixed
16+
- Pull Request [#1205](https://github.com/microsoft/msphpsql/pull/1205) - minimized compilation warnings on Linux and macOS
17+
- Pull Request [#1209](https://github.com/microsoft/msphpsql/pull/1209) - fixed a bug in fetching varbinary max fields as char or wide chars
18+
- Issue [#1210](https://github.com/microsoft/msphpsql/issues/1210) - switched from preview to beta terminology to enable Pickle support
19+
- Issue [#1213](https://github.com/microsoft/msphpsql/issues/1213) - the MACOSX_DEPLOYMENT_TARGET in config files caused linker errors in macOS Big Sur - Pull Request [#1215](https://github.com/microsoft/msphpsql/pull/1215)
20+
21+
### Limitations
22+
- No support for inout / output params when using sql_variant type
23+
- No support for inout / output params when formatting decimal values
24+
- 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
25+
- Always Encrypted requires [MS ODBC Driver 17+](https://docs.microsoft.com/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server)
26+
- Only Windows Certificate Store and Azure Key Vault are supported. Custom Keystores are not yet supported
27+
- Issue [#716](https://github.com/Microsoft/msphpsql/issues/716) - With Always Encrypted enabled, named parameters in subqueries are not supported
28+
- Issue [#1050](https://github.com/microsoft/msphpsql/issues/1050) - With Always Encrypted enabled, insertion requires the column list for any tables with identity columns
29+
- [Always Encrypted limitations](https://docs.microsoft.com/sql/connect/php/using-always-encrypted-php-drivers#limitations-of-the-php-drivers-when-using-always-encrypted)
30+
31+
### Known Issues
32+
- This preview 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.
33+
- Connection pooling on Linux or macOS is not recommended with [unixODBC](http://www.unixodbc.org/) < 2.3.7
34+
- When pooling is enabled in Linux or macOS
35+
- unixODBC <= 2.3.4 (Linux and macOS) might not return proper diagnostic information, such as error messages, warnings and informative messages
36+
- 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)
37+
638
## 5.9.0-preview1 - 2020-10-02
739
Updated PECL release packages. Here is the list of updates:
840

Linux-mac-install.md

+61-62
Large diffs are not rendered by default.

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
The Microsoft Drivers for PHP for Microsoft SQL Server 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.
66

7-
This release contains the SQLSRV and PDO_SQLSRV drivers for PHP 7.2+ with improvements on both drivers and some limitations. Upcoming [releases][releases] will contain additional functionalities, bug fixes, and more.
7+
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.
88

99
## Take our survey
1010

@@ -45,7 +45,7 @@ Azure Pipelines | AppVeyor (Windows) | Travis CI (Linux) | Co
4545
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.
4646

4747
On the client machine:
48-
- PHP 7.2.x (7.2.0 and up on Unix, 7.2.1 and up on Windows), 7.3.x, or 7.4.x
48+
- 7.3.x, 7.4.x, 8.0.x
4949
- [Microsoft ODBC Driver 17, Microsoft ODBC Driver 13, or Microsoft ODBC Driver 11][odbcdoc]
5050
- If using a Web server such as Internet Information Services (IIS) or Apache, it must be configured to run PHP
5151

@@ -82,8 +82,8 @@ Given a version number MAJOR.MINOR.PATCH,
8282

8383
The version number may have trailing pre-release version identifiers to indicate the stability and/or build metadata.
8484

85-
- Pre-release version is denoted by a hyphen followed by `preview` or `RC` and may be followed by a series of dot separated identifiers. Production quality releases do not contain the pre-release version. `preview` has lower precedence than `RC`. Example of precedence: *preview < preview.1 < RC < RC.1*. Note that the PECL package version numbers do not have the hyphen before the pre-release version, owing to restrictions in PECL. Example of a PECL package version number: 1.2.3preview
86-
- Build metadata may be denoted by a plus sign followed by 4 or 5 digits, such as `1.2.3-preview+5678` or `1.2.3+5678`. Build metadata does not figure into the precedence order.
85+
- Pre-release version is denoted by a hyphen followed by `beta` or `RC` followed by a number. Production quality releases do not contain the pre-release version. `beta` has lower precedence than `RC`. Note that the PECL package version numbers do not have the hyphen before the pre-release version, owing to restrictions in PECL. An example of a PECL package version is `5.9.0beta2`.
86+
- Build metadata may be denoted by a plus sign followed by a number of digits, such as `5.9.0-beta2+13930`. Build metadata does not affect the precedence order.
8787

8888
## Future Plans
8989
- Expand SQL Server feature support (example: Azure Active Directory, Always Encrypted, etc.)

appveyor.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ environment:
3030
SQL_INSTANCE: SQL2019
3131
PHP_VC: vs16
3232
PHP_MAJOR_VER: 8.0
33-
PHP_MINOR_VER: 0rc1
33+
PHP_MINOR_VER: 0RC2
3434
PHP_EXE_PATH: Release
3535
THREAD: nts
3636
platform: x86

azure-pipelines.yml

+28-7
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ variables:
1313
trigger:
1414
- dev
1515

16+
pr:
17+
- dev
18+
1619
jobs:
1720
- job: macOS
1821
pool:
@@ -30,8 +33,8 @@ jobs:
3033
- script: |
3134
brew tap
3235
brew tap homebrew/core
33-
brew install autoconf automake libtool
34-
brew install php@$(phpVersion)
36+
brew reinstall autoconf automake libtool
37+
brew reinstall php@$(phpVersion)
3538
php -v
3639
displayName: 'Install PHP'
3740
@@ -60,7 +63,7 @@ jobs:
6063
6164
- job: Linux
6265
variables:
63-
phpver: 7.3
66+
phpver: 7.4
6467
pool:
6568
vmImage: 'ubuntu-18.04'
6669
steps:
@@ -102,8 +105,15 @@ jobs:
102105
displayName: 'Install prerequisites'
103106
104107
- script: |
105-
docker pull mcr.microsoft.com/mssql/server:2017-latest
106-
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=$(pwd)' -p 1433:1433 -h $(host) --name=$(host) -d mcr.microsoft.com/mssql/server:2017-latest
108+
python -m pip install --upgrade pip
109+
python -m pip install --upgrade requests
110+
python -m pip install PyYAML
111+
python -m pip install cpp-coveralls
112+
displayName: 'Install coveralls (upgrade both pip and requests first)'
113+
114+
- script: |
115+
docker pull mcr.microsoft.com/mssql/server:2019-latest
116+
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=$(pwd)' -p 1433:1433 -h $(host) --name=$(host) -d mcr.microsoft.com/mssql/server:2019-latest
107117
docker ps -a
108118
sleep 10
109119
docker exec -t $(host) /opt/mssql-tools/bin/sqlcmd -S $(server) -U $(uid) -P $(pwd) -Q 'select @@Version'
@@ -144,7 +154,7 @@ jobs:
144154
145155
cd $(Build.SourcesDirectory)/source/sqlsrv
146156
ls -al
147-
phpize && ./configure && make && sudo make install
157+
phpize && ./configure LDFLAGS="-lgcov" CXXFLAGS="-O0 --coverage" && make && sudo make install
148158
cp run-tests.php $(Build.SourcesDirectory)/test/functional/sqlsrv
149159
echo extension=sqlsrv.so >> 20-sqlsrv.ini
150160
@@ -153,7 +163,7 @@ jobs:
153163
154164
cd $(Build.SourcesDirectory)/source/pdo_sqlsrv
155165
ls -al
156-
phpize && ./configure && make && sudo make install
166+
phpize && ./configure LDFLAGS="-lgcov" CXXFLAGS="-O0 --coverage" && make && sudo make install
157167
cp run-tests.php $(Build.SourcesDirectory)/test/functional/pdo_sqlsrv
158168
echo extension=pdo_sqlsrv.so >> 30-pdo_sqlsrv.ini
159169
@@ -189,6 +199,17 @@ jobs:
189199
php run-tests.php -P ./*.phpt 2>&1 | tee ../pdo_sqlsrv.log
190200
displayName: 'Run pdo_sqlsrv functional tests'
191201
202+
- script: |
203+
cd $(Build.SourcesDirectory)
204+
echo -e "service_name: Azure Pipelines\n" > .coveralls.yml
205+
coveralls -i ./source/ -e ./source/shared/ -e ./test/ -e ./source/pdo_sqlsrv/shared/core_stream.cpp \
206+
-E r'.*localization*' -E r'.*globalization*' --gcov-options '\-lp'
207+
displayName: 'Invoke coveralls using repo token'
208+
env:
209+
COVERALLS_REPO_TOKEN: $(repo_token)
210+
TRAVIS_JOB_ID: $(Build.BuildId)
211+
TRAVIS_BRANCH: $(Build.SourceBranchName)
212+
192213
- script: |
193214
cd $(Build.SourcesDirectory)/test/functional/
194215
for f in sqlsrv/*.diff; do ls $f 2>/dev/null; cat $f 2>/dev/null; echo ''; done || true

source/pdo_sqlsrv/config.m4

-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ if test "$PHP_PDO_SQLSRV" != "no"; then
7979
HOST_OS_ARCH=`uname`
8080
if test "${HOST_OS_ARCH}" = "Darwin"; then
8181
PDO_SQLSRV_SHARED_LIBADD="$PDO_SQLSRV_SHARED_LIBADD -Wl,-bind_at_load"
82-
MACOSX_DEPLOYMENT_TARGET=`sw_vers -productVersion`
8382
else
8483
PDO_SQLSRV_SHARED_LIBADD="$PDO_SQLSRV_SHARED_LIBADD -Wl,-z,now"
8584
IS_ALPINE_1=`uname -a | cut -f 4 -d ' ' | cut -f 2 -d '-'`

source/pdo_sqlsrv/pdo_dbh.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,8 @@ int pdo_sqlsrv_dbh_begin( _Inout_ pdo_dbh_t *dbh )
912912

913913
DIE ("pdo_sqlsrv_dbh_begin: Uncaught exception occurred.");
914914
}
915+
// Should not have reached here but adding this due to compilation warnings
916+
return 0;
915917
}
916918

917919

@@ -954,6 +956,8 @@ int pdo_sqlsrv_dbh_commit( _Inout_ pdo_dbh_t *dbh )
954956

955957
DIE ("pdo_sqlsrv_dbh_commit: Uncaught exception occurred.");
956958
}
959+
// Should not have reached here but adding this due to compilation warnings
960+
return 0;
957961
}
958962

959963
// pdo_sqlsrv_dbh_rollback
@@ -993,6 +997,8 @@ int pdo_sqlsrv_dbh_rollback( _Inout_ pdo_dbh_t *dbh )
993997

994998
DIE ("pdo_sqlsrv_dbh_rollback: Uncaught exception occurred.");
995999
}
1000+
// Should not have reached here but adding this due to compilation warnings
1001+
return 0;
9961002
}
9971003

9981004
// pdo_sqlsrv_dbh_set_attr

source/pdo_sqlsrv/pdo_init.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ void pdo_error_dtor( _Inout_ zval* elem ) {
116116

117117
PHP_MINIT_FUNCTION(pdo_sqlsrv)
118118
{
119-
SQLSRV_UNUSED( type );
119+
// SQLSRV_UNUSED( type );
120120

121121
// our global variables are initialized in the RINIT function
122122
#if defined(ZTS)
@@ -185,7 +185,7 @@ PHP_MSHUTDOWN_FUNCTION(pdo_sqlsrv)
185185
{
186186
try {
187187

188-
SQLSRV_UNUSED( type );
188+
// SQLSRV_UNUSED( type );
189189

190190
UNREGISTER_INI_ENTRIES();
191191

@@ -213,8 +213,8 @@ PHP_MSHUTDOWN_FUNCTION(pdo_sqlsrv)
213213

214214
PHP_RINIT_FUNCTION(pdo_sqlsrv)
215215
{
216-
SQLSRV_UNUSED( module_number );
217-
SQLSRV_UNUSED( type );
216+
// SQLSRV_UNUSED( module_number );
217+
// SQLSRV_UNUSED( type );
218218

219219
#if defined(ZTS)
220220
ZEND_TSRMLS_CACHE_UPDATE();
@@ -247,8 +247,8 @@ PHP_RINIT_FUNCTION(pdo_sqlsrv)
247247

248248
PHP_RSHUTDOWN_FUNCTION(pdo_sqlsrv)
249249
{
250-
SQLSRV_UNUSED( module_number );
251-
SQLSRV_UNUSED( type );
250+
// SQLSRV_UNUSED( module_number );
251+
// SQLSRV_UNUSED( type );
252252

253253
PDO_LOG_NOTICE("pdo_sqlsrv: entering rshutdown");
254254

source/pdo_sqlsrv/pdo_parser.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ void conn_string_parser::add_key_value_pair( _In_reads_(len) const char* value,
187187
memcpy_s( option, len + 1, value, len );
188188
option[len] = '\0';
189189

190-
valid = core_is_authentication_option_valid( option, len );
190+
valid = AzureADOptions::isAuthValid(option, len);
191191
}
192192
}
193193
if( !valid ) {

source/pdo_sqlsrv/pdo_stmt.cpp

+6-3
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,8 @@ int pdo_sqlsrv_stmt_fetch( _Inout_ pdo_stmt_t *stmt, _In_ enum pdo_fetch_orienta
724724

725725
DIE ("pdo_sqlsrv_stmt_fetch: Unexpected exception occurred.");
726726
}
727+
// Should not have reached here but adding this due to compilation warnings
728+
return 0;
727729
}
728730

729731
// pdo_sqlsrv_stmt_get_col_data
@@ -832,15 +834,16 @@ int pdo_sqlsrv_stmt_get_col_data( _Inout_ pdo_stmt_t *stmt, _In_ int colno,
832834
*len = sizeof(zval);
833835
}
834836

835-
return 1;
836-
}
837-
837+
return 1;
838+
}
838839
catch ( core::CoreException& ) {
839840
return 0;
840841
}
841842
catch ( ... ) {
842843
DIE ("pdo_sqlsrv_stmt_get_col_data: Unexpected exception occurred.");
843844
}
845+
// Should not have reached here but adding this due to compilation warnings
846+
return 0;
844847
}
845848

846849
// pdo_sqlsrv_stmt_set_attr

source/pdo_sqlsrv/pdo_util.cpp

+6-17
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ pdo_error PDO_ERRORS[] = {
379379
},
380380
{
381381
PDO_SQLSRV_ERROR_INVALID_AUTHENTICATION_OPTION,
382-
{ IMSSP, (SQLCHAR*) "Invalid option for the Authentication keyword. Only SqlPassword, ActiveDirectoryPassword, or ActiveDirectoryMsi is supported.", -73, false }
382+
{ IMSSP, (SQLCHAR*) "Invalid option for the Authentication keyword. Only SqlPassword, ActiveDirectoryPassword, ActiveDirectoryMsi or ActiveDirectorySPA is supported.", -73, false }
383383
},
384384
{
385385
SQLSRV_ERROR_CE_DRIVER_REQUIRED,
@@ -465,7 +465,7 @@ pdo_error PDO_ERRORS[] = {
465465
{ UINT_MAX, {} }
466466
};
467467

468-
bool pdo_sqlsrv_handle_env_error( _Inout_ sqlsrv_context& ctx, _In_opt_ unsigned int sqlsrv_error_code, _In_opt_ bool warning,
468+
bool pdo_sqlsrv_handle_env_error( _Inout_ sqlsrv_context& ctx, _In_opt_ unsigned int sqlsrv_error_code, _In_opt_ int warning,
469469
_In_opt_ va_list* print_args )
470470
{
471471
SQLSRV_ASSERT((ctx != NULL), "pdo_sqlsrv_handle_env_error: sqlsrv_context was null");
@@ -488,7 +488,7 @@ bool pdo_sqlsrv_handle_env_error( _Inout_ sqlsrv_context& ctx, _In_opt_ unsigned
488488
}
489489

490490
// pdo error handler for the dbh context.
491-
bool pdo_sqlsrv_handle_dbh_error( _Inout_ sqlsrv_context& ctx, _In_opt_ unsigned int sqlsrv_error_code, _In_opt_ bool warning,
491+
bool pdo_sqlsrv_handle_dbh_error( _Inout_ sqlsrv_context& ctx, _In_opt_ unsigned int sqlsrv_error_code, _In_opt_ int warning,
492492
_In_opt_ va_list* print_args )
493493
{
494494
pdo_dbh_t* dbh = reinterpret_cast<pdo_dbh_t*>( ctx.driver());
@@ -520,7 +520,7 @@ bool pdo_sqlsrv_handle_dbh_error( _Inout_ sqlsrv_context& ctx, _In_opt_ unsigned
520520
}
521521

522522
// PDO error handler for the statement context.
523-
bool pdo_sqlsrv_handle_stmt_error(_Inout_ sqlsrv_context& ctx, _In_opt_ unsigned int sqlsrv_error_code, _In_opt_ bool warning,
523+
bool pdo_sqlsrv_handle_stmt_error(_Inout_ sqlsrv_context& ctx, _In_opt_ unsigned int sqlsrv_error_code, _In_opt_ int warning,
524524
_In_opt_ va_list* print_args)
525525
{
526526
pdo_stmt_t* pdo_stmt = reinterpret_cast<pdo_stmt_t*>(ctx.driver());
@@ -635,20 +635,9 @@ void add_remaining_errors_to_array (_In_ sqlsrv_error const* error, _Inout_ zval
635635
if (error->next != NULL && PDO_SQLSRV_G(report_additional_errors)) {
636636
sqlsrv_error *p = error->next;
637637
while (p != NULL) {
638-
// check if sql state or native message is NULL and handle them accordingly
639-
char *state = "";
640-
char *msg = "";
641-
642-
if (p->sqlstate != NULL) {
643-
state = reinterpret_cast<char*>(p->sqlstate);
644-
}
645-
if (p->native_message != NULL) {
646-
msg = reinterpret_cast<char*>(p->native_message);
647-
}
648-
649-
add_next_index_string(array_z, state);
638+
add_next_index_string(array_z, reinterpret_cast<char*>(p->sqlstate));
650639
add_next_index_long(array_z, p->native_code);
651-
add_next_index_string(array_z, msg);
640+
add_next_index_string(array_z, reinterpret_cast<char*>(p->native_message));
652641

653642
p = p-> next;
654643
}

source/pdo_sqlsrv/php_pdo_sqlsrv_int.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,11 @@ struct pdo_error {
285285
// called when an error occurs in the core layer. These routines are set as the error_callback in a
286286
// context. The context is passed to this function since it contains the function
287287

288-
bool pdo_sqlsrv_handle_env_error( _Inout_ sqlsrv_context& ctx, _In_opt_ unsigned int sqlsrv_error_code, _In_opt_ bool warning,
288+
bool pdo_sqlsrv_handle_env_error( _Inout_ sqlsrv_context& ctx, _In_opt_ unsigned int sqlsrv_error_code, _In_opt_ int warning,
289289
_In_opt_ va_list* print_args );
290-
bool pdo_sqlsrv_handle_dbh_error( _Inout_ sqlsrv_context& ctx, _In_opt_ unsigned int sqlsrv_error_code, _In_opt_ bool warning,
290+
bool pdo_sqlsrv_handle_dbh_error( _Inout_ sqlsrv_context& ctx, _In_opt_ unsigned int sqlsrv_error_code, _In_opt_ int warning,
291291
_In_opt_ va_list* print_args );
292-
bool pdo_sqlsrv_handle_stmt_error( _Inout_ sqlsrv_context& ctx, _In_opt_ unsigned int sqlsrv_error_code, _In_opt_ bool warning,
292+
bool pdo_sqlsrv_handle_stmt_error( _Inout_ sqlsrv_context& ctx, _In_opt_ unsigned int sqlsrv_error_code, _In_opt_ int warning,
293293
_In_opt_ va_list* print_args );
294294

295295
// common routine to transfer a sqlsrv_context's error to a PDO zval

0 commit comments

Comments
 (0)