diff options
-rw-r--r-- | REFLECTION | 2 | ||||
-rw-r--r-- | php-sqlsrv.spec | 87 | ||||
-rw-r--r-- | sqlsrv-pr153.patch | 22 | ||||
-rw-r--r-- | sqlsrv-pr154.patch | 40 | ||||
-rw-r--r-- | sqlsrv-pr155.patch | 23 | ||||
-rw-r--r-- | sqlsrv-pr157.patch | 45 |
6 files changed, 58 insertions, 161 deletions
@@ -1,4 +1,4 @@ -Extension [ <persistent> extension #115 sqlsrv version 4.0.4 ] { +Extension [ <persistent> extension #117 sqlsrv version 4.0.5.0 ] { - INI { Entry [ sqlsrv.WarningsReturnAsErrors <ALL> ] diff --git a/php-sqlsrv.spec b/php-sqlsrv.spec index 34a0854..2bb37fc 100644 --- a/php-sqlsrv.spec +++ b/php-sqlsrv.spec @@ -12,6 +12,7 @@ %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) %global gh_owner Microsoft %global gh_project msphpsql +%global from_pecl 1 %global extname sqlsrv %global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} @@ -20,26 +21,22 @@ Name: %{?scl_prefix}php-sqlsrv Summary: Microsoft Drivers for PHP for SQL Server -Version: 4.0.4 -Release: 5%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Version: 4.0.5 +Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: MIT Group: Development/Languages URL: https://github.com/Microsoft/msphpsql +%if %{from_pecl} +Source0: http://pecl.php.net/get/%{extname}-%{version}.tgz +Source1: http://pecl.php.net/get/pdo_%{extname}-%{version}.tgz +%else Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}-%{gh_short}.tar.gz +%endif -# https://github.com/Microsoft/msphpsql/pull/153 - build -Patch0: %{extname}-pr153.patch -# https://github.com/Microsoft/msphpsql/pull/154 - odbcver -Patch1: %{extname}-pr154.patch -# https://github.com/Microsoft/msphpsql/pull/155 - PHP 7.1 -Patch2: %{extname}-pr155.patch -# https://github.com/Microsoft/msphpsql/pull/157 - buffer overflow -Patch3: %{extname}-pr157.patch - -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: %{?scl_prefix}php-devel > 7 BuildRequires: %{?scl_prefix}php-pdo +BuildRequires: %{?scl_prefix}php-pear BuildRequires: msodbcsql-devel >= 13 BuildRequires: unixODBC-devel >= 2.3.1 @@ -91,28 +88,33 @@ Package built for PHP %(%{__php} -n -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VER %prep +%if %{from_pecl} +%setup -qcT +mkdir NTS + +tar xf %{SOURCE0} +mv %{extname}-%{version}/LICENSE . +mv %{extname}-%{version} NTS/%{extname} +mv package.xml NTS/%{extname} + +tar xf %{SOURCE1} +mv pdo_%{extname}-%{version} NTS/pdo_%{extname} +mv package.xml NTS/pdo_%{extname} +%else %setup -qc -cd %{gh_project}-%{gh_commit} -%patch0 -p1 -b .pr153 -%patch1 -p1 -b .pr154 -%patch2 -p1 -b .pr155 -%patch3 -p1 -b .pr157 -cd .. - mv %{gh_project}-%{gh_commit}/source NTS +mv %{gh_project}-%{gh_commit}/LICENSE . +%endif cd NTS -sed -e '/VER_FILEVERSION_STR/s/4.0.0.0/%{version}/' \ - -i sqlsrv/version.h pdo_sqlsrv/version.h - # Sanity check, really often broken extver=$(sed -n '/#define VER_FILEVERSION_STR/{s/.* "//;s/".*$//;p}' sqlsrv/version.h) -if test "x${extver}" != "x%{version}%{?prever}"; then +if test "x${extver}" != "x%{version}.0%{?prever}"; then : Error: Upstream extension version is ${extver}, expecting %{version}%{?prever}. exit 1 fi extver=$(sed -n '/#define VER_FILEVERSION_STR/{s/.* "//;s/".*$//;p}' pdo_sqlsrv/version.h) -if test "x${extver}" != "x%{version}%{?prever}"; then +if test "x${extver}" != "x%{version}.0%{?prever}"; then : Error: Upstream extension version is ${extver}, expecting %{version}%{?prever}. exit 1 fi @@ -177,8 +179,8 @@ make %{?_smp_mflags} %install -rm -rf %{buildroot} -ver=$(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;') +install -Dpm 644 NTS/%{extname}/package.xml %{buildroot}%{pecl_xmldir}/php-pecl-%{extname}.xml +install -Dpm 644 NTS/pdo_%{extname}/package.xml %{buildroot}%{pecl_xmldir}/php-pecl-pdo-%{extname}.xml make -C NTS/%{extname} install INSTALL_ROOT=%{buildroot} make -C NTS/pdo_%{extname} install INSTALL_ROOT=%{buildroot} @@ -212,14 +214,34 @@ install -D -m 644 %{ininame} %{buildroot}%{php_ztsinidir}/%{ininame} %endif -%clean -rm -rf %{buildroot} +%if 0%{?fedora} < 24 +# when pear installed alone, after us +%triggerin -- %{?scl_prefix}php-pear +if [ -x %{__pecl} ] ; then + %{pecl_install} %{pecl_xmldir}/php-pecl-%{extname}.xml >/dev/null || : + %{pecl_install} %{pecl_xmldir}/php-pecl-pdo-%{extname}.xml >/dev/null || : +fi + +# posttrans as pear can be installed after us +%posttrans +if [ -x %{__pecl} ] ; then + %{pecl_install} %{pecl_xmldir}/php-pecl-%{extname}.xml >/dev/null || : + %{pecl_install} %{pecl_xmldir}/php-pecl-pdo-%{extname}.xml >/dev/null || : +fi + +%postun +if [ $1 -eq 0 -a -x %{__pecl} ] ; then + %{pecl_uninstall} %{extname} >/dev/null || : + %{pecl_uninstall} pdo_%{extname} >/dev/null || : +fi +%endif %files -%defattr(-,root,root,-) %{!?_licensedir:%global license %%doc} -%license %{gh_project}-%{gh_commit}/LICENSE +%license LICENSE +%{pecl_xmldir}/php-pecl-%{extname}.xml +%{pecl_xmldir}/php-pecl-pdo-%{extname}.xml %config(noreplace) %{php_inidir}/%{ininame} %{php_extdir}/%{extname}.so @@ -233,6 +255,11 @@ rm -rf %{buildroot} %changelog +* Sat Oct 1 2016 Remi Collet <remi@remirepo.net> - 4.0.5-1 +- update to 4.0.5, sources from PECL +- drop all patches merged upstream +- open https://github.com/Microsoft/msphpsql/issues/164 + * Tue Sep 20 2016 Remi Collet <remi@remirepo.net> - 4.0.4-5 - use the splitted msodbcsql packages diff --git a/sqlsrv-pr153.patch b/sqlsrv-pr153.patch deleted file mode 100644 index 566879a..0000000 --- a/sqlsrv-pr153.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 4152c7bc585f6fff7658776c7a6312b1fbbaedd9 Mon Sep 17 00:00:00 2001 -From: Remi Collet <remi@famillecollet.com> -Date: Fri, 16 Sep 2016 14:49:56 +0200 -Subject: [PATCH] Fix #152 build failure, unneded come - ---- - source/pdo_sqlsrv/config.m4 | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/source/pdo_sqlsrv/config.m4 b/source/pdo_sqlsrv/config.m4 -index dd88ae8..dd83f58 100644 ---- a/source/pdo_sqlsrv/config.m4 -+++ b/source/pdo_sqlsrv/config.m4 -@@ -44,7 +44,7 @@ if test "$PHP_PDO_SQLSRV" != "no"; then - PHP_ADD_LIBRARY(stdc++, 1, PDO_SQLSRV_SHARED_LIBADD) - PHP_ADD_LIBRARY(odbc, 1, PDO_SQLSRV_SHARED_LIBADD) - AC_DEFINE(HAVE_PDO_SQLSRV, 1, [ ]) -- PHP_NEW_EXTENSION(pdo_sqlsrv, $sources, $ext_shared,,-I$pdo_cv_inc_path, -std=c++11) -+ PHP_NEW_EXTENSION(pdo_sqlsrv, $sources, $ext_shared,,-I$pdo_cv_inc_path -std=c++11) - PHP_SUBST(PDO_SQLSRV_SHARED_LIBADD) - PHP_ADD_EXTENSION_DEP(pdo_sqlsrv, pdo) - fi diff --git a/sqlsrv-pr154.patch b/sqlsrv-pr154.patch deleted file mode 100644 index ccab311..0000000 --- a/sqlsrv-pr154.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 9082b42b45f9bb926189aba875a8a62c54bfb1b8 Mon Sep 17 00:00:00 2001 -From: Remi Collet <fedora@famillecollet.com> -Date: Fri, 16 Sep 2016 15:31:23 +0200 -Subject: [PATCH] ensure correct ODBCVER is used - ---- - source/pdo_sqlsrv/xplat.h | 4 ++++ - source/sqlsrv/xplat.h | 4 ++++ - 2 files changed, 8 insertions(+) - -diff --git a/source/pdo_sqlsrv/xplat.h b/source/pdo_sqlsrv/xplat.h -index bede13c..3408f00 100644 ---- a/source/pdo_sqlsrv/xplat.h -+++ b/source/pdo_sqlsrv/xplat.h -@@ -228,6 +228,10 @@ typedef windowsULongLong_t ULONGLONG; - #define UNIXODBC - #endif - -+/* can be defined in php sources */ -+#ifdef ODBCVER -+#undef ODBCVER -+#endif - // Build the mplat driver as an ODBC 3.8 driver, so that all of the - // source code shared with Windows SNAC (which is ODBC 3.8) compiles. - #define ODBCVER 0x0380 -diff --git a/source/sqlsrv/xplat.h b/source/sqlsrv/xplat.h -index bede13c..3408f00 100644 ---- a/source/sqlsrv/xplat.h -+++ b/source/sqlsrv/xplat.h -@@ -228,6 +228,10 @@ typedef windowsULongLong_t ULONGLONG; - #define UNIXODBC - #endif - -+/* can be defined in php sources */ -+#ifdef ODBCVER -+#undef ODBCVER -+#endif - // Build the mplat driver as an ODBC 3.8 driver, so that all of the - // source code shared with Windows SNAC (which is ODBC 3.8) compiles. - #define ODBCVER 0x0380 diff --git a/sqlsrv-pr155.patch b/sqlsrv-pr155.patch deleted file mode 100644 index f655f40..0000000 --- a/sqlsrv-pr155.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 66f003c661c430031f7a55bd470fe0da1536a5b1 Mon Sep 17 00:00:00 2001 -From: Remi Collet <fedora@famillecollet.com> -Date: Fri, 16 Sep 2016 15:53:20 +0200 -Subject: [PATCH] Fix PHP 7.1 build - ---- - source/sqlsrv/stmt.cpp | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/source/sqlsrv/stmt.cpp b/source/sqlsrv/stmt.cpp -index 90bb025..b3f1dac 100644 ---- a/source/sqlsrv/stmt.cpp -+++ b/source/sqlsrv/stmt.cpp -@@ -881,7 +881,9 @@ PHP_FUNCTION( sqlsrv_fetch_object ) - - memset( &fci, 0, sizeof( fci )); - fci.size = sizeof( fci ); -+#if PHP_VERSION_ID < 70100 - fci.function_table = &( class_entry )->function_table; -+#endif - ZVAL_UNDEF( &( fci.function_name ) ); - fci.retval = &ctor_retval_z; - fci.param_count = num_params; diff --git a/sqlsrv-pr157.patch b/sqlsrv-pr157.patch deleted file mode 100644 index 11818e6..0000000 --- a/sqlsrv-pr157.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 5e27f69cbb66d7468645f337858c2b140274b4b6 Mon Sep 17 00:00:00 2001 -From: Remi Collet <fedora@famillecollet.com> -Date: Mon, 19 Sep 2016 17:49:57 +0200 -Subject: [PATCH] fix buffer overflow, raising segfault in pdo driver - ---- - source/pdo_sqlsrv/pdo_dbh.cpp | 2 +- - source/pdo_sqlsrv/pdo_stmt.cpp | 4 ++-- - 2 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/source/pdo_sqlsrv/pdo_dbh.cpp b/source/pdo_sqlsrv/pdo_dbh.cpp -index 20f996b..079eca0 100644 ---- a/source/pdo_sqlsrv/pdo_dbh.cpp -+++ b/source/pdo_sqlsrv/pdo_dbh.cpp -@@ -361,7 +361,7 @@ struct pdo_dbh_methods pdo_sqlsrv_dbh_methods = { - { \ - pdo_sqlsrv_dbh* driver_dbh = reinterpret_cast<pdo_sqlsrv_dbh*>( dbh->driver_data ); \ - driver_dbh->set_func( __FUNCTION__ ); \ -- int length = strlen(__FUNCTION__); \ -+ int length = strlen(__FUNCTION__)+strlen(": entering"); \ - char func[length+1]; \ - LOG( SEV_NOTICE, strcat(strcpy(func, __FUNCTION__), ": entering")); \ - } -diff --git a/source/pdo_sqlsrv/pdo_stmt.cpp b/source/pdo_sqlsrv/pdo_stmt.cpp -index dc989f4..4486404 100644 ---- a/source/pdo_sqlsrv/pdo_stmt.cpp -+++ b/source/pdo_sqlsrv/pdo_stmt.cpp -@@ -339,7 +339,7 @@ void stmt_option_emulate_prepares:: operator()( sqlsrv_stmt* stmt, stmt_option c - { \ - pdo_sqlsrv_stmt* driver_stmt = reinterpret_cast<pdo_sqlsrv_stmt*>( stmt->driver_data ); \ - driver_stmt->set_func( __FUNCTION__ ); \ -- int length = strlen(__FUNCTION__); \ -+ int length = strlen(__FUNCTION__)+strlen(": entering"); \ - char func[length+1]; \ - LOG( SEV_NOTICE, strcat(strcpy(func, __FUNCTION__), ": entering")); \ - } -@@ -427,7 +427,7 @@ int pdo_sqlsrv_stmt_describe_col(pdo_stmt_t *stmt, int colno TSRMLS_DC) - #else - pdo_sqlsrv_stmt* driver_stmtt = reinterpret_cast<pdo_sqlsrv_stmt*>( stmt->driver_data ); - driver_stmtt->set_func( __FUNCTION__ ); -- int length = strlen(__FUNCTION__); -+ int length = strlen(__FUNCTION__)+strlen(": entering"); - char func[length+1]; - LOG( SEV_NOTICE, strcat(strcpy(func, __FUNCTION__), ": entering")); - #endif |