From 53c5793ad42dae1f690bd3530c0b8d58020b4141 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sat, 21 Jul 2018 06:41:12 +0200 Subject: v5.3.0 --- PHPINFO | 11 ++++++++ REFLECTION | 2 +- pdo.patch | 13 ++++++++++ php-sqlsrv.spec | 16 ++++++++++-- shared.patch | 33 ++++++++++++++++++++++++ sqlsrv.patch | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 150 insertions(+), 3 deletions(-) create mode 100644 PHPINFO create mode 100644 pdo.patch create mode 100644 shared.patch create mode 100644 sqlsrv.patch diff --git a/PHPINFO b/PHPINFO new file mode 100644 index 0000000..652b8cf --- /dev/null +++ b/PHPINFO @@ -0,0 +1,11 @@ + +sqlsrv + +sqlsrv support => enabled +ExtensionVer => 5.3.0 + +Directive => Local Value => Master Value +sqlsrv.WarningsReturnAsErrors => On => On +sqlsrv.LogSeverity => 0 => 0 +sqlsrv.LogSubsystems => 0 => 0 +sqlsrv.ClientBufferMaxKBSize => 10240 => 10240 diff --git a/REFLECTION b/REFLECTION index 8ede604..f95947f 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,4 +1,4 @@ -Extension [ extension #140 sqlsrv version 5.2.1-preview ] { +Extension [ extension #140 sqlsrv version 5.3.0 ] { - INI { Entry [ sqlsrv.WarningsReturnAsErrors ] diff --git a/pdo.patch b/pdo.patch new file mode 100644 index 0000000..d62bb22 --- /dev/null +++ b/pdo.patch @@ -0,0 +1,13 @@ +diff --git a/source/pdo_sqlsrv/pdo_util.cpp b/source/pdo_sqlsrv/pdo_util.cpp +index 343537d..b0083e4 100644 +--- a/source/pdo_sqlsrv/pdo_util.cpp ++++ b/source/pdo_sqlsrv/pdo_util.cpp +@@ -512,7 +512,7 @@ bool pdo_sqlsrv_handle_dbh_error( _Inout_ sqlsrv_context& ctx, _In_opt_ unsigned + msg = static_cast( sqlsrv_malloc( msg_len ) ); + core_sqlsrv_format_message( msg, static_cast( msg_len ), WARNING_TEMPLATE, error->sqlstate, error->native_code, + error->native_message ); +- php_error( E_WARNING, msg ); ++ php_error( E_WARNING, "%s", msg ); + } + ctx.set_last_error( error ); + break; diff --git a/php-sqlsrv.spec b/php-sqlsrv.spec index e032c80..71884b6 100644 --- a/php-sqlsrv.spec +++ b/php-sqlsrv.spec @@ -25,8 +25,8 @@ Name: %{?scl_prefix}php-sqlsrv Summary: Microsoft Drivers for PHP for SQL Server -%global tarversion 5.2.1preview -Version: 5.2.1~preview +%global tarversion 5.3.0 +Version: 5.3.0 Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: MIT Group: Development/Languages @@ -40,6 +40,7 @@ Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit} %endif BuildRequires: %{?dtsprefix}gcc +BuildRequires: %{?dtsprefix}gcc-c++ BuildRequires: %{?scl_prefix}php-devel > 7 BuildRequires: %{?scl_prefix}php-pdo BuildRequires: %{?scl_prefix}php-pear @@ -74,6 +75,10 @@ Obsoletes: php71w-sqlsrv <= %{version} Obsoletes: php72u-sqlsrv <= %{version} Obsoletes: php72w-sqlsrv <= %{version} %endif +%if "%{php_version}" > "7.3" +Obsoletes: php73u-sqlsrv <= %{version} +Obsoletes: php73w-sqlsrv <= %{version} +%endif %endif %if 0%{?fedora} < 20 && 0%{?rhel} < 7 @@ -273,6 +278,13 @@ fi %changelog +* Sat Jul 21 2018 Remi Collet - 5.3.0-1 +- update to 5.3.0 (stable) + +* Wed Jul 4 2018 Remi Collet - 5.2.1~preview-2 +- add fix for PHP 7.3 from + https://github.com/Microsoft/msphpsql/pull/810 + * Thu May 31 2018 Remi Collet - 5.2.1~preview-1 - update to 5.2.1preview (devel) diff --git a/shared.patch b/shared.patch new file mode 100644 index 0000000..4090070 --- /dev/null +++ b/shared.patch @@ -0,0 +1,33 @@ +diff --git a/source/shared/core_sqlsrv.h b/source/shared/core_sqlsrv.h +index 39e53b1..2d6a357 100644 +--- a/source/shared/core_sqlsrv.h ++++ b/source/shared/core_sqlsrv.h +@@ -2381,10 +2381,7 @@ namespace core { + + inline void sqlsrv_array_init( _Inout_ sqlsrv_context& ctx, _Out_ zval* new_array TSRMLS_DC) + { +- int zr = ::array_init(new_array); +- CHECK_ZEND_ERROR( zr, ctx, SQLSRV_ERROR_ZEND_HASH ) { +- throw CoreException(); +- } ++ array_init(new_array); + } + + inline void sqlsrv_php_stream_from_zval_no_verify( _Inout_ sqlsrv_context& ctx, _Outref_result_maybenull_ php_stream*& stream, _In_opt_ zval* stream_z TSRMLS_DC ) +diff --git a/source/shared/core_util.cpp b/source/shared/core_util.cpp +index c537f76..1f6af42 100644 +--- a/source/shared/core_util.cpp ++++ b/source/shared/core_util.cpp +@@ -353,10 +353,10 @@ void die( _In_opt_ const char* msg, ... ) + DWORD rc = FormatMessage( FORMAT_MESSAGE_FROM_STRING, msg, 0, 0, last_err_msg, sizeof( last_err_msg ), &format_args ); + va_end( format_args ); + if( rc == 0 ) { +- php_error( E_ERROR, reinterpret_cast( INTERNAL_FORMAT_ERROR )); ++ php_error( E_ERROR, "%s", reinterpret_cast( INTERNAL_FORMAT_ERROR )); + } + +- php_error( E_ERROR, last_err_msg ); ++ php_error( E_ERROR, "%s", last_err_msg ); + } + + namespace { diff --git a/sqlsrv.patch b/sqlsrv.patch new file mode 100644 index 0000000..8ea4ce1 --- /dev/null +++ b/sqlsrv.patch @@ -0,0 +1,78 @@ +diff --git a/source/sqlsrv/stmt.cpp b/source/sqlsrv/stmt.cpp +index 96aeae8..7757868 100644 +--- a/source/sqlsrv/stmt.cpp ++++ b/source/sqlsrv/stmt.cpp +@@ -889,7 +889,9 @@ PHP_FUNCTION( sqlsrv_fetch_object ) + fci.object = Z_OBJ_P( &retval_z ); + + memset( &fcic, 0, sizeof( fcic )); ++#if PHP_VERSION_ID < 70300 + fcic.initialized = 1; ++#endif + fcic.function_handler = class_entry->constructor; + fcic.calling_scope = class_entry; + +@@ -1806,10 +1808,8 @@ void fetch_fields_common( _Inout_ ss_sqlsrv_stmt* stmt, _In_ zend_long fetch_typ + field_names.transferred(); + } + +- int zr = array_init( &fields ); +- CHECK_ZEND_ERROR( zr, stmt, SQLSRV_ERROR_ZEND_HASH ) { +- throw ss::SSException(); +- } ++ int zr; ++ array_init( &fields ); + + for( int i = 0; i < num_cols; ++i ) { + SQLLEN field_len = -1; +diff --git a/source/sqlsrv/util.cpp b/source/sqlsrv/util.cpp +index 50b963e..a68b93c 100644 +--- a/source/sqlsrv/util.cpp ++++ b/source/sqlsrv/util.cpp +@@ -506,10 +506,7 @@ PHP_FUNCTION( sqlsrv_errors ) + int result; + zval err_z; + ZVAL_UNDEF( &err_z ); +- result = array_init( &err_z ); +- if( result == FAILURE ) { +- RETURN_FALSE; +- } ++ array_init( &err_z ); + if( flags == SQLSRV_ERR_ALL || flags == SQLSRV_ERR_ERRORS ) { + if( Z_TYPE( SQLSRV_G( errors )) == IS_ARRAY && !sqlsrv_merge_zend_hash( &err_z, &SQLSRV_G( errors ) TSRMLS_CC )) { + zval_ptr_dtor(&err_z); +@@ -747,9 +744,7 @@ void copy_error_to_zval( _Inout_ zval* error_z, _In_ sqlsrv_error_const* error, + _In_ bool warning TSRMLS_DC ) + { + +- if( array_init( error_z ) == FAILURE ) { +- DIE( "Fatal error during error processing" ); +- } ++ array_init( error_z ); + + // sqlstate + zval temp; +@@ -837,10 +832,7 @@ bool handle_errors_and_warnings( _Inout_ sqlsrv_context& ctx, _Inout_ zval* repo + if( Z_TYPE_P( reported_chain ) == IS_NULL ) { + + reported_chain_was_null = true; +- zr = array_init( reported_chain ); +- if( zr == FAILURE ) { +- DIE( "Fatal error in handle_errors_and_warnings" ); +- } ++ array_init( reported_chain ); + } + else { + prev_reported_cnt = zend_hash_num_elements( Z_ARRVAL_P( reported_chain )); +@@ -852,10 +844,7 @@ bool handle_errors_and_warnings( _Inout_ sqlsrv_context& ctx, _Inout_ zval* repo + if( Z_TYPE_P( ignored_chain ) == IS_NULL ) { + + ignored_chain_was_null = true; +- zr = array_init( ignored_chain ); +- if( zr == FAILURE ) { +- DIE( "Fatal error in handle_errors_and_warnings" ); +- } ++ array_init( ignored_chain ); + } + } + -- cgit