From 1d0b7136b7e14900b3f0ffa690ead0ae35e316b8 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 2 Aug 2017 16:32:32 +0200 Subject: add patch for EL-6, fix undefined symbol: sqlite3_errstr and sqlite2_close_v2 --- php-sqlite3.patch | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ php-sqlite3_2.patch | 38 ++++++++++++++++++++++++++++++++++++++ php.spec | 10 +++++++++- 3 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 php-sqlite3.patch create mode 100644 php-sqlite3_2.patch diff --git a/php-sqlite3.patch b/php-sqlite3.patch new file mode 100644 index 0000000..cdb7d84 --- /dev/null +++ b/php-sqlite3.patch @@ -0,0 +1,53 @@ +From 666cb6c80226467be262c088a26246c48cdef7e5 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Wed, 2 Aug 2017 14:01:56 +0200 +Subject: [PATCH] fix build with old system libsqlite (sqlite3_errstr may be + missing) + +--- + ext/sqlite3/config0.m4 | 5 ++++- + ext/sqlite3/sqlite3.c | 4 ++++ + 2 files changed, 8 insertions(+), 1 deletion(-) + +diff --git a/ext/sqlite3/config0.m4 b/ext/sqlite3/config0.m4 +index 3aa4492..ba760e1 100644 +--- a/ext/sqlite3/config0.m4 ++++ b/ext/sqlite3/config0.m4 +@@ -53,6 +53,9 @@ if test $PHP_SQLITE3 != "no"; then + PHP_CHECK_LIBRARY(sqlite3,sqlite3_column_table_name,[ + AC_DEFINE(SQLITE_ENABLE_COLUMN_METADATA, 1, [have sqlite3 with column metadata enabled]) + ]) ++ PHP_CHECK_LIBRARY(sqlite3,sqlite3_errstr,[ ++ AC_DEFINE(HAVE_SQLITE3_ERRSTR, 1, [have sqlite3_errstr function]) ++ ]) + + PHP_CHECK_LIBRARY(sqlite3,sqlite3_load_extension, + [], +@@ -75,7 +78,7 @@ if test $PHP_SQLITE3 != "no"; then + debug_flags="-DSQLITE_DEBUG=1" + fi + +- other_flags="-DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_CORE=1 -DSQLITE_ENABLE_COLUMN_METADATA=1" ++ other_flags="-DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_CORE=1 -DSQLITE_ENABLE_COLUMN_METADATA=1 -DHAVE_SQLITE3_ERRSTR=1" + + dnl As long as intl is not shared we can have ICU support + if test "$PHP_INTL" = "yes" && test "$PHP_INTL_SHARED" != "yes"; then +diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c +index dcbc03c..a22f455 100644 +--- a/ext/sqlite3/sqlite3.c ++++ b/ext/sqlite3/sqlite3.c +@@ -148,7 +148,11 @@ PHP_METHOD(sqlite3, open) + #endif + if (rc != SQLITE_OK) { + zend_throw_exception_ex(zend_ce_exception, 0, "Unable to open database: %s", ++#ifdef HAVE_SQLITE3_ERRSTR + db_obj->db ? sqlite3_errmsg(db_obj->db) : sqlite3_errstr(rc)); ++#else ++ db_obj->db ? sqlite3_errmsg(db_obj->db) : ""); ++#endif + if (fullpath != filename) { + efree(fullpath); + } +-- +2.1.4 + diff --git a/php-sqlite3_2.patch b/php-sqlite3_2.patch new file mode 100644 index 0000000..575d705 --- /dev/null +++ b/php-sqlite3_2.patch @@ -0,0 +1,38 @@ +diff --git a/ext/pdo_sqlite/config.m4 b/ext/pdo_sqlite/config.m4 +index 44b22b6..b050eea 100644 +--- a/ext/pdo_sqlite/config.m4 ++++ b/ext/pdo_sqlite/config.m4 +@@ -68,6 +68,9 @@ if test "$PHP_PDO_SQLITE" != "no"; then + PHP_CHECK_LIBRARY(sqlite3,sqlite3_key,[ + AC_DEFINE(HAVE_SQLITE3_KEY,1, [have commercial sqlite3 with crypto support]) + ]) ++ PHP_CHECK_LIBRARY(sqlite3,sqlite3_close_v2,[ ++ AC_DEFINE(HAVE_SQLITE3_CLOSE_V2, 1, [have sqlite3_close_v2]) ++ ]) + + PHP_SUBST(PDO_SQLITE_SHARED_LIBADD) + PHP_NEW_EXTENSION(pdo_sqlite, $php_pdo_sqlite_sources_core, $ext_shared,,-I$pdo_cv_inc_path) +@@ -79,6 +82,7 @@ if test "$PHP_PDO_SQLITE" != "no"; then + threadsafe_flags="-DSQLITE_THREADSAFE=0" + fi + ++ AC_DEFINE(HAVE_SQLITE3_CLOSE_V2, 1, [have sqlite3_close_v2]) + other_flags="-DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_CORE=1 -DSQLITE_ENABLE_COLUMN_METADATA=1" + + dnl As long as intl is not shared we can have ICU support +diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c +index 3d32f23..e234406 100644 +--- a/ext/pdo_sqlite/sqlite_driver.c ++++ b/ext/pdo_sqlite/sqlite_driver.c +@@ -161,7 +161,11 @@ static int sqlite_handle_closer(pdo_dbh_t *dbh) /* {{{ */ + + pdo_sqlite_cleanup_callbacks(H); + if (H->db) { ++#ifdef HAVE_SQLITE3_CLOSE_V2 + sqlite3_close_v2(H->db); ++#else ++ sqlite3_close(H->db); ++#endif + H->db = NULL; + } + if (einfo->errmsg) { diff --git a/php.spec b/php.spec index 0bc25f3..3dc55f6 100644 --- a/php.spec +++ b/php.spec @@ -134,7 +134,7 @@ %global gh_owner php %global gh_project php-src %global rcver beta2 -%global rpmrel 14 +%global rpmrel 15 Summary: PHP scripting language for creating dynamic web sites @@ -181,6 +181,8 @@ Patch6: php-5.6.3-embed.patch Patch7: php-5.3.0-recode.patch Patch8: php-7.1.0-libdb.patch Patch9: php-7.0.7-curl.patch +Patch10: php-sqlite3.patch +Patch11: php-sqlite3_2.patch # Functional changes Patch40: php-7.1.3-dlopen.patch @@ -909,6 +911,8 @@ low-level PHP extension for the libsodium cryptographic library. %if 0%{?rhel} %patch9 -p1 -b .curltls %endif +%patch10 -p1 -b .errstr +%patch11 -p1 -b .v2 %patch40 -p1 -b .dlopen %if 0%{?fedora} >= 24 || 0%{?rhel} >= 5 @@ -1845,6 +1849,10 @@ fi %changelog +* Tue Aug 1 2017 Remi Collet - 7.2.0-0.15.beta2 +- add patch for EL-6, fix undefined symbol: sqlite3_errstr +- revert use of sqlite3_close_v2 on EL-6 + * Tue Aug 1 2017 Remi Collet - 7.2.0-0.14.beta2 - update to 7.2.0beta2 - oci8 version is now 2.1.7 -- cgit