From 1ef5e3e2e85bb2fe0c49a49f3c55281cd359cef0 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 25 Mar 2015 10:58:14 +0100 Subject: php70-php - initial work for 7.0.0-dev - ereg, mssql, mysql and sybase_ct extensions are removed - add pdo-dblib subpackage (instead of php-mssql) - disable oci8 extension, not adapted yet for 7.0 --- Makefile | 2 +- php-5.4.0-dlopen.patch | 17 -- php-5.4.7-odbctimer.patch | 58 ---- php-5.6.3-fixheader.patch | 23 -- php-5.6.3-includedir.patch | 11 - php-5.6.3-libdb.patch | 86 ------ php-5.6.3-systzdata-v11.patch | 655 ------------------------------------------ php-7.0.0-dlopen.patch | 31 ++ php-7.0.0-fixheader.patch | 23 ++ php-7.0.0-includedir.patch | 11 + php-7.0.0-libdb.patch | 88 ++++++ php-7.0.0-odbctimer.patch | 45 +++ php-7.0.0-systzdata-v11.patch | 646 +++++++++++++++++++++++++++++++++++++++++ php.spec | 138 ++++----- 14 files changed, 919 insertions(+), 915 deletions(-) delete mode 100644 php-5.4.0-dlopen.patch delete mode 100644 php-5.4.7-odbctimer.patch delete mode 100644 php-5.6.3-fixheader.patch delete mode 100644 php-5.6.3-includedir.patch delete mode 100644 php-5.6.3-libdb.patch delete mode 100644 php-5.6.3-systzdata-v11.patch create mode 100644 php-7.0.0-dlopen.patch create mode 100644 php-7.0.0-fixheader.patch create mode 100644 php-7.0.0-includedir.patch create mode 100644 php-7.0.0-libdb.patch create mode 100644 php-7.0.0-odbctimer.patch create mode 100644 php-7.0.0-systzdata-v11.patch diff --git a/Makefile b/Makefile index 5493b6b..458d5a9 100644 --- a/Makefile +++ b/Makefile @@ -3,4 +3,4 @@ NAME := $(shell basename $(SRCDIR)) include ../../common/Makefile srpm: - rpmbuild $(RPMDEFINES) $(SRCDEFINES) --define 'scl php56' -bs $(NAME).spec + rpmbuild $(RPMDEFINES) $(SRCDEFINES) --define 'scl php70' -bs $(NAME).spec diff --git a/php-5.4.0-dlopen.patch b/php-5.4.0-dlopen.patch deleted file mode 100644 index c2b0e40..0000000 --- a/php-5.4.0-dlopen.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- php-5.4.0RC5/Zend/zend.h.dlopen 2012-01-18 17:10:33.972013835 +0100 -+++ php-5.4.0RC5/Zend/zend.h 2012-01-18 17:12:39.175019492 +0100 -@@ -90,11 +90,11 @@ - # endif - - # if defined(RTLD_GROUP) && defined(RTLD_WORLD) && defined(RTLD_PARENT) --# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL | RTLD_GROUP | RTLD_WORLD | RTLD_PARENT) -+# define DL_LOAD(libname) dlopen(libname, RTLD_NOW | RTLD_GLOBAL | RTLD_GROUP | RTLD_WORLD | RTLD_PARENT) - # elif defined(RTLD_DEEPBIND) --# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL | RTLD_DEEPBIND) -+# define DL_LOAD(libname) dlopen(libname, RTLD_NOW | RTLD_GLOBAL | RTLD_DEEPBIND) - # else --# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL) -+# define DL_LOAD(libname) dlopen(libname, RTLD_NOW | RTLD_GLOBAL) - # endif - # define DL_UNLOAD dlclose - # if defined(DLSYM_NEEDS_UNDERSCORE) diff --git a/php-5.4.7-odbctimer.patch b/php-5.4.7-odbctimer.patch deleted file mode 100644 index 88c4da4..0000000 --- a/php-5.4.7-odbctimer.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 657494235eafe048e9fa6a19dcdb3c73a0cbe6ec Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 27 Sep 2012 13:45:32 +0200 -Subject: [PATCH] Fixed bug #63171, script hangs if odbc call during timeout - ---- - ext/odbc/php_odbc.c | 21 ++++++++++++++------- - 1 file changed, 14 insertions(+), 7 deletions(-) - -diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c -index 52d46b2..2169e65 100644 ---- a/ext/odbc/php_odbc.c -+++ b/ext/odbc/php_odbc.c -@@ -431,7 +431,8 @@ static void _free_odbc_result(zend_rsrc_list_entry *rsrc TSRMLS_DC) - efree(res->values); - res->values = NULL; - } -- if (res->stmt) { -+ /* If aborted via timer expiration, don't try to call any unixODBC function */ -+ if (res->stmt && !(PG(connection_status) & PHP_CONNECTION_TIMEOUT)) { - #if defined(HAVE_SOLID) || defined(HAVE_SOLID_30) || defined(HAVE_SOLID_35) - SQLTransact(res->conn_ptr->henv, res->conn_ptr->hdbc, - (SQLUSMALLINT) SQL_COMMIT); -@@ -484,9 +485,12 @@ static void _close_odbc_conn(zend_rsrc_list_entry *rsrc TSRMLS_DC) - } - } - -- safe_odbc_disconnect(conn->hdbc); -- SQLFreeConnect(conn->hdbc); -- SQLFreeEnv(conn->henv); -+ /* If aborted via timer expiration, don't try to call any unixODBC function */ -+ if (!(PG(connection_status) & PHP_CONNECTION_TIMEOUT)) { -+ safe_odbc_disconnect(conn->hdbc); -+ SQLFreeConnect(conn->hdbc); -+ SQLFreeEnv(conn->henv); -+ } - efree(conn); - ODBCG(num_links)--; - } -@@ -512,9 +516,12 @@ static void _close_odbc_pconn(zend_rsrc_list_entry *rsrc TSRMLS_DC) - } - } - -- safe_odbc_disconnect(conn->hdbc); -- SQLFreeConnect(conn->hdbc); -- SQLFreeEnv(conn->henv); -+ /* If aborted via timer expiration, don't try to call any unixODBC function */ -+ if (!(PG(connection_status) & PHP_CONNECTION_TIMEOUT)) { -+ safe_odbc_disconnect(conn->hdbc); -+ SQLFreeConnect(conn->hdbc); -+ SQLFreeEnv(conn->henv); -+ } - free(conn); - - ODBCG(num_links)--; --- -1.7.10 - diff --git a/php-5.6.3-fixheader.patch b/php-5.6.3-fixheader.patch deleted file mode 100644 index 7089535..0000000 --- a/php-5.6.3-fixheader.patch +++ /dev/null @@ -1,23 +0,0 @@ - -Make generated php_config.h constant across rebuilds. - ---- php-5.4.9/configure.in.fixheader -+++ php-5.4.9/configure.in -@@ -1275,7 +1275,7 @@ fi - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PHP_LDFLAGS" - EXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM $PHP_LDFLAGS" - --PHP_BUILD_DATE=`date '+%Y-%m-%d'` -+PHP_BUILD_DATE=`date '+%Y-%m-%d' -r $srcdir/NEWS` - AC_DEFINE_UNQUOTED(PHP_BUILD_DATE,"$PHP_BUILD_DATE",[PHP build date]) - - case $host_alias in -@@ -1286,7 +1286,7 @@ case $host_alias in - AC_DEFINE_UNQUOTED(PHP_UNAME,"$PHP_UNAME",[hardcode for each of the cross compiler host]) - ;; - *) -- PHP_UNAME=`uname -a | xargs` -+ PHP_UNAME=`uname | xargs` - AC_DEFINE_UNQUOTED(PHP_UNAME,"$PHP_UNAME",[uname -a output]) - PHP_OS=`uname | xargs` - AC_DEFINE_UNQUOTED(PHP_OS,"$PHP_OS",[uname output]) diff --git a/php-5.6.3-includedir.patch b/php-5.6.3-includedir.patch deleted file mode 100644 index 748f64f..0000000 --- a/php-5.6.3-includedir.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- php-5.2.0/configure.in.includedir -+++ php-5.2.0/configure.in -@@ -1242,7 +1242,7 @@ - EXPANDED_DATADIR=$datadir - EXPANDED_PHP_CONFIG_FILE_PATH=`eval echo "$PHP_CONFIG_FILE_PATH"` - EXPANDED_PHP_CONFIG_FILE_SCAN_DIR=`eval echo "$PHP_CONFIG_FILE_SCAN_DIR"` --INCLUDE_PATH=.:$EXPANDED_PEAR_INSTALLDIR -+INCLUDE_PATH=.:$EXPANDED_PEAR_INSTALLDIR:${EXPANDED_DATADIR}/php:/usr/share/pear:/usr/share/php - - exec_prefix=$old_exec_prefix - libdir=$old_libdir diff --git a/php-5.6.3-libdb.patch b/php-5.6.3-libdb.patch deleted file mode 100644 index dc0e40b..0000000 --- a/php-5.6.3-libdb.patch +++ /dev/null @@ -1,86 +0,0 @@ ---- php-5.4.7/ext/dba/config.m4.orig 2012-09-20 12:23:00.548322754 +0200 -+++ php-5.4.7/ext/dba/config.m4 2012-09-20 12:28:07.656380829 +0200 -@@ -312,57 +312,13 @@ - dbdp4="/usr/local/BerkeleyDB.4." - dbdp5="/usr/local/BerkeleyDB.5." - for i in $PHP_DB4 ${dbdp5}1 ${dbdp5}0 ${dbdp4}8 ${dbdp4}7 ${dbdp4}6 ${dbdp4}5 ${dbdp4}4 ${dbdp4}3 ${dbdp4}2 ${dbdp4}1 ${dbdp}0 /usr/local /usr; do -- if test -f "$i/db5/db.h"; then -- THIS_PREFIX=$i -- THIS_INCLUDE=$i/db5/db.h -- break -- elif test -f "$i/db4/db.h"; then -- THIS_PREFIX=$i -- THIS_INCLUDE=$i/db4/db.h -- break -- elif test -f "$i/include/db5.1/db.h"; then -- THIS_PREFIX=$i -- THIS_INCLUDE=$i/include/db5.1/db.h -- break -- elif test -f "$i/include/db5.0/db.h"; then -- THIS_PREFIX=$i -- THIS_INCLUDE=$i/include/db5.0/db.h -- break -- elif test -f "$i/include/db4.8/db.h"; then -- THIS_PREFIX=$i -- THIS_INCLUDE=$i/include/db4.8/db.h -- break -- elif test -f "$i/include/db4.7/db.h"; then -- THIS_PREFIX=$i -- THIS_INCLUDE=$i/include/db4.7/db.h -- break -- elif test -f "$i/include/db4.6/db.h"; then -- THIS_PREFIX=$i -- THIS_INCLUDE=$i/include/db4.6/db.h -- break -- elif test -f "$i/include/db4.5/db.h"; then -- THIS_PREFIX=$i -- THIS_INCLUDE=$i/include/db4.5/db.h -- break -- elif test -f "$i/include/db4/db.h"; then -- THIS_PREFIX=$i -- THIS_INCLUDE=$i/include/db4/db.h -- break -- elif test -f "$i/include/db/db4.h"; then -- THIS_PREFIX=$i -- THIS_INCLUDE=$i/include/db/db4.h -- break -- elif test -f "$i/include/db4.h"; then -- THIS_PREFIX=$i -- THIS_INCLUDE=$i/include/db4.h -- break -- elif test -f "$i/include/db.h"; then -+ if test -f "$i/include/db.h"; then - THIS_PREFIX=$i - THIS_INCLUDE=$i/include/db.h - break - fi - done -- PHP_DBA_DB_CHECK(4, db-5.1 db-5.0 db-4.8 db-4.7 db-4.6 db-4.5 db-4.4 db-4.3 db-4.2 db-4.1 db-4.0 db-4 db4 db, [(void)db_create((DB**)0, (DB_ENV*)0, 0)]) -+ PHP_DBA_DB_CHECK(4, db, [(void)db_create((DB**)0, (DB_ENV*)0, 0)]) - fi - PHP_DBA_STD_RESULT(db4,Berkeley DB4) - ---- php-5.4.7/ext/dba/dba.c.old 2012-09-19 14:55:23.868456900 +0200 -+++ php-5.4.7/ext/dba/dba.c 2012-09-19 15:02:42.796009320 +0200 -@@ -52,6 +52,10 @@ - #include "php_qdbm.h" - #include "php_tcadb.h" - -+#ifdef DB4_INCLUDE_FILE -+#include DB4_INCLUDE_FILE -+#endif -+ - /* {{{ arginfo */ - ZEND_BEGIN_ARG_INFO_EX(arginfo_dba_popen, 0, 0, 2) - ZEND_ARG_INFO(0, path) -@@ -535,6 +539,10 @@ - - php_info_print_table_start(); - php_info_print_table_row(2, "DBA support", "enabled"); -+#ifdef DB_VERSION_STRING -+ php_info_print_table_row(2, "libdb header version", DB_VERSION_STRING); -+ php_info_print_table_row(2, "libdb library version", db_version(NULL, NULL, NULL)); -+#endif - if (handlers.c) { - smart_str_0(&handlers); - php_info_print_table_row(2, "Supported handlers", handlers.c); diff --git a/php-5.6.3-systzdata-v11.patch b/php-5.6.3-systzdata-v11.patch deleted file mode 100644 index bfca49b..0000000 --- a/php-5.6.3-systzdata-v11.patch +++ /dev/null @@ -1,655 +0,0 @@ -Add support for use of the system timezone database, rather -than embedding a copy. Discussed upstream but was not desired. - -History: -r11: use canonical names to avoid more case sensitivity issues - round lat/long from zone.tab towards zero per builtin db -r10: make timezone case insensitive -r9: fix another compile error without --with-system-tzdata configured (Michael Heimpold) -r8: fix compile error without --with-system-tzdata configured -r7: improve check for valid timezone id to exclude directories -r6: fix fd leak in r5, fix country code/BC flag use in - timezone_identifiers_list() using system db, - fix use of PECL timezonedb to override system db, -r5: reverts addition of "System/Localtime" fake tzname. - updated for 5.3.0, parses zone.tab to pick up mapping between - timezone name, country code and long/lat coords -r4: added "System/Localtime" tzname which uses /etc/localtime -r3: fix a crash if /usr/share/zoneinfo doesn't exist (Raphael Geissert) -r2: add filesystem trawl to set up name alias index -r1: initial revision - -diff --git a/ext/date/lib/parse_tz.c b/ext/date/lib/parse_tz.c -index 5d2aec9..671b398 100644 ---- a/ext/date/lib/parse_tz.c -+++ b/ext/date/lib/parse_tz.c -@@ -20,6 +20,16 @@ - - #include "timelib.h" - -+#ifdef HAVE_SYSTEM_TZDATA -+#include -+#include -+#include -+#include -+#include -+ -+#include "php_scandir.h" -+#endif -+ - #include - - #ifdef HAVE_LOCALE_H -@@ -31,7 +41,12 @@ - #else - #include - #endif -+ -+#ifndef HAVE_SYSTEM_TZDATA - #include "timezonedb.h" -+#endif -+ -+#include - - #if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__)) - # if defined(__LITTLE_ENDIAN__) -@@ -51,9 +66,14 @@ - - static void read_preamble(const unsigned char **tzf, timelib_tzinfo *tz) - { -- /* skip ID */ -- *tzf += 4; -- -+ if (memcmp(tzf, "TZif", 4) == 0) { -+ *tzf += 20; -+ return; -+ } -+ -+ /* skip ID */ -+ *tzf += 4; -+ - /* read BC flag */ - tz->bc = (**tzf == '\1'); - *tzf += 1; -@@ -256,7 +276,418 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz) - } - } - --static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const timelib_tzdb *tzdb) -+#ifdef HAVE_SYSTEM_TZDATA -+ -+#ifdef HAVE_SYSTEM_TZDATA_PREFIX -+#define ZONEINFO_PREFIX HAVE_SYSTEM_TZDATA_PREFIX -+#else -+#define ZONEINFO_PREFIX "/usr/share/zoneinfo" -+#endif -+ -+/* System timezone database pointer. */ -+static const timelib_tzdb *timezonedb_system; -+ -+/* Hash table entry for the cache of the zone.tab mapping table. */ -+struct location_info { -+ char code[2]; -+ double latitude, longitude; -+ char name[64]; -+ char *comment; -+ struct location_info *next; -+}; -+ -+/* Cache of zone.tab. */ -+static struct location_info **system_location_table; -+ -+/* Size of the zone.tab hash table; a random-ish prime big enough to -+ * prevent too many collisions. */ -+#define LOCINFO_HASH_SIZE (1021) -+ -+/* Compute a case insensitive hash of str */ -+static uint32_t tz_hash(const char *str) -+{ -+ const unsigned char *p = (const unsigned char *)str; -+ uint32_t hash = 5381; -+ int c; -+ -+ while ((c = tolower(*p++)) != '\0') { -+ hash = (hash << 5) ^ hash ^ c; -+ } -+ -+ return hash % LOCINFO_HASH_SIZE; -+} -+ -+/* Parse an ISO-6709 date as used in zone.tab. Returns end of the -+ * parsed string on success, or NULL on parse error. On success, -+ * writes the parsed number to *result. */ -+static char *parse_iso6709(char *p, double *result) -+{ -+ double v, sign; -+ char *pend; -+ size_t len; -+ -+ if (*p == '+') -+ sign = 1.0; -+ else if (*p == '-') -+ sign = -1.0; -+ else -+ return NULL; -+ -+ p++; -+ for (pend = p; *pend >= '0' && *pend <= '9'; pend++) -+ ;; -+ -+ /* Annoying encoding used by zone.tab has no decimal point, so use -+ * the length to determine the format: -+ * -+ * 4 = DDMM -+ * 5 = DDDMM -+ * 6 = DDMMSS -+ * 7 = DDDMMSS -+ */ -+ len = pend - p; -+ if (len < 4 || len > 7) { -+ return NULL; -+ } -+ -+ /* p => [D]DD */ -+ v = (p[0] - '0') * 10.0 + (p[1] - '0'); -+ p += 2; -+ if (len == 5 || len == 7) -+ v = v * 10.0 + (*p++ - '0'); -+ /* p => MM[SS] */ -+ v += (10.0 * (p[0] - '0') -+ + p[1] - '0') / 60.0; -+ p += 2; -+ /* p => [SS] */ -+ if (len > 5) { -+ v += (10.0 * (p[0] - '0') -+ + p[1] - '0') / 3600.0; -+ p += 2; -+ } -+ -+ /* Round to five decimal place, not because it's a good idea, -+ * but, because the builtin data uses rounded data, so, match -+ * that. */ -+ *result = trunc(v * sign * 100000.0) / 100000.0; -+ -+ return p; -+} -+ -+/* This function parses the zone.tab file to build up the mapping of -+ * timezone to country code and geographic location, and returns a -+ * hash table. The hash table is indexed by the function: -+ * -+ * tz_hash(timezone-name) -+ */ -+static struct location_info **create_location_table(void) -+{ -+ struct location_info **li, *i; -+ char zone_tab[PATH_MAX]; -+ char line[512]; -+ FILE *fp; -+ -+ strncpy(zone_tab, ZONEINFO_PREFIX "/zone.tab", sizeof zone_tab); -+ -+ fp = fopen(zone_tab, "r"); -+ if (!fp) { -+ return NULL; -+ } -+ -+ li = calloc(LOCINFO_HASH_SIZE, sizeof *li); -+ -+ while (fgets(line, sizeof line, fp)) { -+ char *p = line, *code, *name, *comment; -+ uint32_t hash; -+ double latitude, longitude; -+ -+ while (isspace(*p)) -+ p++; -+ -+ if (*p == '#' || *p == '\0' || *p == '\n') -+ continue; -+ -+ if (!isalpha(p[0]) || !isalpha(p[1]) || p[2] != '\t') -+ continue; -+ -+ /* code => AA */ -+ code = p; -+ p[2] = 0; -+ p += 3; -+ -+ /* coords => [+-][D]DDMM[SS][+-][D]DDMM[SS] */ -+ p = parse_iso6709(p, &latitude); -+ if (!p) { -+ continue; -+ } -+ p = parse_iso6709(p, &longitude); -+ if (!p) { -+ continue; -+ } -+ -+ if (!p || *p != '\t') { -+ continue; -+ } -+ -+ /* name = string */ -+ name = ++p; -+ while (*p != '\t' && *p && *p != '\n') -+ p++; -+ -+ *p++ = '\0'; -+ -+ /* comment = string */ -+ comment = p; -+ while (*p != '\t' && *p && *p != '\n') -+ p++; -+ -+ if (*p == '\n' || *p == '\t') -+ *p = '\0'; -+ -+ hash = tz_hash(name); -+ i = malloc(sizeof *i); -+ memcpy(i->code, code, 2); -+ strncpy(i->name, name, sizeof i->name); -+ i->comment = strdup(comment); -+ i->longitude = longitude; -+ i->latitude = latitude; -+ i->next = li[hash]; -+ li[hash] = i; -+ /* printf("%s [%u, %f, %f]\n", name, hash, latitude, longitude); */ -+ } -+ -+ fclose(fp); -+ -+ return li; -+} -+ -+/* Return location info from hash table, using given timezone name. -+ * Returns NULL if the name could not be found. */ -+const struct location_info *find_zone_info(struct location_info **li, -+ const char *name) -+{ -+ uint32_t hash = tz_hash(name); -+ const struct location_info *l; -+ -+ if (!li) { -+ return NULL; -+ } -+ -+ for (l = li[hash]; l; l = l->next) { -+ if (strcasecmp(l->name, name) == 0) -+ return l; -+ } -+ -+ return NULL; -+} -+ -+/* Filter out some non-tzdata files and the posix/right databases, if -+ * present. */ -+static int index_filter(const struct dirent *ent) -+{ -+ return strcmp(ent->d_name, ".") != 0 -+ && strcmp(ent->d_name, "..") != 0 -+ && strcmp(ent->d_name, "posix") != 0 -+ && strcmp(ent->d_name, "posixrules") != 0 -+ && strcmp(ent->d_name, "right") != 0 -+ && strstr(ent->d_name, ".tab") == NULL; -+} -+ -+static int sysdbcmp(const void *first, const void *second) -+{ -+ const timelib_tzdb_index_entry *alpha = first, *beta = second; -+ -+ return strcasecmp(alpha->id, beta->id); -+} -+ -+ -+/* Create the zone identifier index by trawling the filesystem. */ -+static void create_zone_index(timelib_tzdb *db) -+{ -+ size_t dirstack_size, dirstack_top; -+ size_t index_size, index_next; -+ timelib_tzdb_index_entry *db_index; -+ char **dirstack; -+ -+ /* LIFO stack to hold directory entries to scan; each slot is a -+ * directory name relative to the zoneinfo prefix. */ -+ dirstack_size = 32; -+ dirstack = malloc(dirstack_size * sizeof *dirstack); -+ dirstack_top = 1; -+ dirstack[0] = strdup(""); -+ -+ /* Index array. */ -+ index_size = 64; -+ db_index = malloc(index_size * sizeof *db_index); -+ index_next = 0; -+ -+ do { -+ struct dirent **ents; -+ char name[PATH_MAX], *top; -+ int count; -+ -+ /* Pop the top stack entry, and iterate through its contents. */ -+ top = dirstack[--dirstack_top]; -+ snprintf(name, sizeof name, ZONEINFO_PREFIX "/%s", top); -+ -+ count = php_scandir(name, &ents, index_filter, php_alphasort); -+ -+ while (count > 0) { -+ struct stat st; -+ const char *leaf = ents[count - 1]->d_name; -+ -+ snprintf(name, sizeof name, ZONEINFO_PREFIX "/%s/%s", -+ top, leaf); -+ -+ if (strlen(name) && stat(name, &st) == 0) { -+ /* Name, relative to the zoneinfo prefix. */ -+ const char *root = top; -+ -+ if (root[0] == '/') root++; -+ -+ snprintf(name, sizeof name, "%s%s%s", root, -+ *root ? "/": "", leaf); -+ -+ if (S_ISDIR(st.st_mode)) { -+ if (dirstack_top == dirstack_size) { -+ dirstack_size *= 2; -+ dirstack = realloc(dirstack, -+ dirstack_size * sizeof *dirstack); -+ } -+ dirstack[dirstack_top++] = strdup(name); -+ } -+ else { -+ if (index_next == index_size) { -+ index_size *= 2; -+ db_index = realloc(db_index, -+ index_size * sizeof *db_index); -+ } -+ -+ db_index[index_next++].id = strdup(name); -+ } -+ } -+ -+ free(ents[--count]); -+ } -+ -+ if (count != -1) free(ents); -+ free(top); -+ } while (dirstack_top); -+ -+ qsort(db_index, index_next, sizeof *db_index, sysdbcmp); -+ -+ db->index = db_index; -+ db->index_size = index_next; -+ -+ free(dirstack); -+} -+ -+#define FAKE_HEADER "1234\0??\1??" -+#define FAKE_UTC_POS (7 - 4) -+ -+/* Create a fake data segment for database 'sysdb'. */ -+static void fake_data_segment(timelib_tzdb *sysdb, -+ struct location_info **info) -+{ -+ size_t n; -+ char *data, *p; -+ -+ data = malloc(3 * sysdb->index_size + 7); -+ -+ p = mempcpy(data, FAKE_HEADER, sizeof(FAKE_HEADER) - 1); -+ -+ for (n = 0; n < sysdb->index_size; n++) { -+ const struct location_info *li; -+ timelib_tzdb_index_entry *ent; -+ -+ ent = (timelib_tzdb_index_entry *)&sysdb->index[n]; -+ -+ /* Lookup the timezone name in the hash table. */ -+ if (strcmp(ent->id, "UTC") == 0) { -+ ent->pos = FAKE_UTC_POS; -+ continue; -+ } -+ -+ li = find_zone_info(info, ent->id); -+ if (li) { -+ /* If found, append the BC byte and the -+ * country code; set the position for this -+ * section of timezone data. */ -+ ent->pos = (p - data) - 4; -+ *p++ = '\1'; -+ *p++ = li->code[0]; -+ *p++ = li->code[1]; -+ } -+ else { -+ /* If not found, the timezone data can -+ * point at the header. */ -+ ent->pos = 0; -+ } -+ } -+ -+ sysdb->data = (unsigned char *)data; -+} -+ -+/* Returns true if the passed-in stat structure describes a -+ * probably-valid timezone file. */ -+static int is_valid_tzfile(const struct stat *st) -+{ -+ return S_ISREG(st->st_mode) && st->st_size > 20; -+} -+ -+/* To allow timezone names to be used case-insensitively, find the -+ * canonical name for this timezone, if possible. */ -+static const char *canonical_tzname(const char *timezone) -+{ -+ if (timezonedb_system) { -+ timelib_tzdb_index_entry *ent, lookup; -+ -+ lookup.id = (char *)timezone; -+ -+ ent = bsearch(&lookup, timezonedb_system->index, -+ timezonedb_system->index_size, sizeof lookup, -+ sysdbcmp); -+ if (ent) { -+ return ent->id; -+ } -+ } -+ -+ return timezone; -+} -+ -+/* Return the mmap()ed tzfile if found, else NULL. On success, the -+ * length of the mapped data is placed in *length. */ -+static char *map_tzfile(const char *timezone, size_t *length) -+{ -+ char fname[PATH_MAX]; -+ struct stat st; -+ char *p; -+ int fd; -+ -+ if (timezone[0] == '\0' || strstr(timezone, "..") != NULL) { -+ return NULL; -+ } -+ -+ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", canonical_tzname(timezone)); -+ -+ fd = open(fname, O_RDONLY); -+ if (fd == -1) { -+ return NULL; -+ } else if (fstat(fd, &st) != 0 || !is_valid_tzfile(&st)) { -+ close(fd); -+ return NULL; -+ } -+ -+ *length = st.st_size; -+ p = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0); -+ close(fd); -+ -+ return p != MAP_FAILED ? p : NULL; -+} -+ -+#endif -+ -+static int inmem_seek_to_tz_position(const unsigned char **tzf, char *timezone, const timelib_tzdb *tzdb) - { - int left = 0, right = tzdb->index_size - 1; - #ifdef HAVE_SETLOCALE -@@ -295,36 +726,135 @@ static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const - return 0; - } - -+static int seek_to_tz_position(const unsigned char **tzf, char *timezone, -+ char **map, size_t *maplen, -+ const timelib_tzdb *tzdb) -+{ -+#ifdef HAVE_SYSTEM_TZDATA -+ if (tzdb == timezonedb_system) { -+ char *orig; -+ -+ orig = map_tzfile(timezone, maplen); -+ if (orig == NULL) { -+ return 0; -+ } -+ -+ (*tzf) = (unsigned char *)orig ; -+ *map = orig; -+ -+ return 1; -+ } -+ else -+#endif -+ { -+ return inmem_seek_to_tz_position(tzf, timezone, tzdb); -+ } -+} -+ - const timelib_tzdb *timelib_builtin_db(void) - { -+#ifdef HAVE_SYSTEM_TZDATA -+ if (timezonedb_system == NULL) { -+ timelib_tzdb *tmp = malloc(sizeof *tmp); -+ -+ tmp->version = "0.system"; -+ tmp->data = NULL; -+ create_zone_index(tmp); -+ system_location_table = create_location_table(); -+ fake_data_segment(tmp, system_location_table); -+ timezonedb_system = tmp; -+ } -+ -+ -+ return timezonedb_system; -+#else - return &timezonedb_builtin; -+#endif - } - - const timelib_tzdb_index_entry *timelib_timezone_builtin_identifiers_list(int *count) - { -+#ifdef HAVE_SYSTEM_TZDATA -+ *count = timezonedb_system->index_size; -+ return timezonedb_system->index; -+#else - *count = sizeof(timezonedb_idx_builtin) / sizeof(*timezonedb_idx_builtin); - return timezonedb_idx_builtin; -+#endif - } - - int timelib_timezone_id_is_valid(char *timezone, const timelib_tzdb *tzdb) - { - const unsigned char *tzf; -- return (seek_to_tz_position(&tzf, timezone, tzdb)); -+ -+#ifdef HAVE_SYSTEM_TZDATA -+ if (tzdb == timezonedb_system) { -+ char fname[PATH_MAX]; -+ struct stat st; -+ -+ if (timezone[0] == '\0' || strstr(timezone, "..") != NULL) { -+ return 0; -+ } -+ -+ if (system_location_table) { -+ if (find_zone_info(system_location_table, timezone) != NULL) { -+ /* found in cache */ -+ return 1; -+ } -+ } -+ -+ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", canonical_tzname(timezone)); -+ -+ return stat(fname, &st) == 0 && is_valid_tzfile(&st); -+ } -+#endif -+ -+ return (inmem_seek_to_tz_position(&tzf, timezone, tzdb)); - } - - timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb) - { - const unsigned char *tzf; -+ char *memmap = NULL; -+ size_t maplen; - timelib_tzinfo *tmp; - -- if (seek_to_tz_position(&tzf, timezone, tzdb)) { -+ if (seek_to_tz_position(&tzf, timezone, &memmap, &maplen, tzdb)) { - tmp = timelib_tzinfo_ctor(timezone); - - read_preamble(&tzf, tmp); - read_header(&tzf, tmp); - read_transistions(&tzf, tmp); - read_types(&tzf, tmp); -- read_location(&tzf, tmp); -+ -+#ifdef HAVE_SYSTEM_TZDATA -+ if (memmap) { -+ const struct location_info *li; -+ -+ /* TZif-style - grok the location info from the system database, -+ * if possible. */ -+ -+ if ((li = find_zone_info(system_location_table, timezone)) != NULL) { -+ tmp->location.comments = strdup(li->comment); -+ strncpy(tmp->location.country_code, li->code, 2); -+ tmp->location.longitude = li->longitude; -+ tmp->location.latitude = li->latitude; -+ tmp->bc = 1; -+ } -+ else { -+ strcpy(tmp->location.country_code, "??"); -+ tmp->bc = 0; -+ tmp->location.comments = strdup(""); -+ } -+ -+ /* Now done with the mmap segment - discard it. */ -+ munmap(memmap, maplen); -+ } else -+#endif -+ { -+ /* PHP-style - use the embedded info. */ -+ read_location(&tzf, tmp); -+ } - } else { - tmp = NULL; - } -diff --git a/ext/date/lib/timelib.m4 b/ext/date/lib/timelib.m4 -index c725572..4c837c7 100644 ---- a/ext/date/lib/timelib.m4 -+++ b/ext/date/lib/timelib.m4 -@@ -78,3 +78,17 @@ stdlib.h - - dnl Check for strtoll, atoll - AC_CHECK_FUNCS(strtoll atoll strftime) -+ -+PHP_ARG_WITH(system-tzdata, for use of system timezone data, -+[ --with-system-tzdata[=DIR] to specify use of system timezone data], -+no, no) -+ -+if test "$PHP_SYSTEM_TZDATA" != "no"; then -+ AC_DEFINE(HAVE_SYSTEM_TZDATA, 1, [Define if system timezone data is used]) -+ -+ if test "$PHP_SYSTEM_TZDATA" != "yes"; then -+ AC_DEFINE_UNQUOTED(HAVE_SYSTEM_TZDATA_PREFIX, "$PHP_SYSTEM_TZDATA", -+ [Define for location of system timezone data]) -+ fi -+fi -+ - diff --git a/php-7.0.0-dlopen.patch b/php-7.0.0-dlopen.patch new file mode 100644 index 0000000..0cef75f --- /dev/null +++ b/php-7.0.0-dlopen.patch @@ -0,0 +1,31 @@ +diff -up php-src-02be73b5fac63a02313b9fe0f204c65d4828edeb/sapi/litespeed/lsapilib.c.dlopen php-src-02be73b5fac63a02313b9fe0f204c65d4828edeb/sapi/litespeed/lsapilib.c +--- php-src-02be73b5fac63a02313b9fe0f204c65d4828edeb/sapi/litespeed/lsapilib.c.dlopen 2015-03-25 08:54:25.529213259 +0100 ++++ php-src-02be73b5fac63a02313b9fe0f204c65d4828edeb/sapi/litespeed/lsapilib.c 2015-03-25 08:54:57.937345809 +0100 +@@ -582,7 +582,7 @@ static int (*fp_lve_leave)(struct liblve + static int (*fp_lve_jail)( struct passwd *, char *) = NULL; + static int lsapi_load_lve_lib() + { +- s_liblve = dlopen("liblve.so.0", RTLD_LAZY); ++ s_liblve = dlopen("liblve.so.0", RTLD_NOW); + if (s_liblve) + { + fp_lve_is_available = dlsym(s_liblve, "lve_is_available"); +diff -up php-src-02be73b5fac63a02313b9fe0f204c65d4828edeb/Zend/zend.h.dlopen php-src-02be73b5fac63a02313b9fe0f204c65d4828edeb/Zend/zend.h +diff -up php-src-02be73b5fac63a02313b9fe0f204c65d4828edeb/Zend/zend_portability.h.dlopen php-src-02be73b5fac63a02313b9fe0f204c65d4828edeb/Zend/zend_portability.h +--- php-src-02be73b5fac63a02313b9fe0f204c65d4828edeb/Zend/zend_portability.h.dlopen 2015-03-25 08:53:31.701993105 +0100 ++++ php-src-02be73b5fac63a02313b9fe0f204c65d4828edeb/Zend/zend_portability.h 2015-03-25 08:56:09.976640451 +0100 +@@ -122,11 +122,11 @@ + # endif + + # if defined(RTLD_GROUP) && defined(RTLD_WORLD) && defined(RTLD_PARENT) +-# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL | RTLD_GROUP | RTLD_WORLD | RTLD_PARENT) ++# define DL_LOAD(libname) dlopen(libname, RTLD_NOW | RTLD_GLOBAL | RTLD_GROUP | RTLD_WORLD | RTLD_PARENT) + # elif defined(RTLD_DEEPBIND) +-# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL | RTLD_DEEPBIND) ++# define DL_LOAD(libname) dlopen(libname, RTLD_NOW | RTLD_GLOBAL | RTLD_DEEPBIND) + # else +-# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL) ++# define DL_LOAD(libname) dlopen(libname, RTLD_NOW | RTLD_GLOBAL) + # endif + # define DL_UNLOAD dlclose + # if defined(DLSYM_NEEDS_UNDERSCORE) diff --git a/php-7.0.0-fixheader.patch b/php-7.0.0-fixheader.patch new file mode 100644 index 0000000..771a19e --- /dev/null +++ b/php-7.0.0-fixheader.patch @@ -0,0 +1,23 @@ + +Make generated php_config.h constant across rebuilds. + +--- php-7.0.0/configure.in.fixheader ++++ php-7.0.0/configure.in +@@ -1278,7 +1278,7 @@ fi + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PHP_LDFLAGS" + EXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM $PHP_LDFLAGS" + +-PHP_BUILD_DATE=`date '+%Y-%m-%d'` ++PHP_BUILD_DATE=`date '+%Y-%m-%d' -r $srcdir/NEWS` + AC_DEFINE_UNQUOTED(PHP_BUILD_DATE,"$PHP_BUILD_DATE",[PHP build date]) + + case $host_alias in +@@ -1289,7 +1289,7 @@ case $host_alias in + AC_DEFINE_UNQUOTED(PHP_UNAME,"$PHP_UNAME",[hardcode for each of the cross compiler host]) + ;; + *) +- PHP_UNAME=`uname -a | xargs` ++ PHP_UNAME=`uname | xargs` + AC_DEFINE_UNQUOTED(PHP_UNAME,"$PHP_UNAME",[uname -a output]) + PHP_OS=`uname | xargs` + AC_DEFINE_UNQUOTED(PHP_OS,"$PHP_OS",[uname output]) diff --git a/php-7.0.0-includedir.patch b/php-7.0.0-includedir.patch new file mode 100644 index 0000000..a19d502 --- /dev/null +++ b/php-7.0.0-includedir.patch @@ -0,0 +1,11 @@ +--- php-7.0.0/configure.in.includedir ++++ php-7.0.0/configure.in +@@ -1245,7 +1245,7 @@ + EXPANDED_DATADIR=$datadir + EXPANDED_PHP_CONFIG_FILE_PATH=`eval echo "$PHP_CONFIG_FILE_PATH"` + EXPANDED_PHP_CONFIG_FILE_SCAN_DIR=`eval echo "$PHP_CONFIG_FILE_SCAN_DIR"` +-INCLUDE_PATH=.:$EXPANDED_PEAR_INSTALLDIR ++INCLUDE_PATH=.:$EXPANDED_PEAR_INSTALLDIR:${EXPANDED_DATADIR}/php:/usr/share/pear:/usr/share/php + + exec_prefix=$old_exec_prefix + libdir=$old_libdir diff --git a/php-7.0.0-libdb.patch b/php-7.0.0-libdb.patch new file mode 100644 index 0000000..9806389 --- /dev/null +++ b/php-7.0.0-libdb.patch @@ -0,0 +1,88 @@ +diff -up php-src-02be73b5fac63a02313b9fe0f204c65d4828edeb/ext/dba/config.m4.libdb php-src-02be73b5fac63a02313b9fe0f204c65d4828edeb/ext/dba/config.m4 +--- php-src-02be73b5fac63a02313b9fe0f204c65d4828edeb/ext/dba/config.m4.libdb 2015-03-25 07:01:04.000000000 +0100 ++++ php-src-02be73b5fac63a02313b9fe0f204c65d4828edeb/ext/dba/config.m4 2015-03-25 08:39:57.404661073 +0100 +@@ -312,57 +312,13 @@ if test "$PHP_DB4" != "no"; then + dbdp4="/usr/local/BerkeleyDB.4." + dbdp5="/usr/local/BerkeleyDB.5." + for i in $PHP_DB4 ${dbdp5}1 ${dbdp5}0 ${dbdp4}8 ${dbdp4}7 ${dbdp4}6 ${dbdp4}5 ${dbdp4}4 ${dbdp4}3 ${dbdp4}2 ${dbdp4}1 ${dbdp}0 /usr/local /usr; do +- if test -f "$i/db5/db.h"; then +- THIS_PREFIX=$i +- THIS_INCLUDE=$i/db5/db.h +- break +- elif test -f "$i/db4/db.h"; then +- THIS_PREFIX=$i +- THIS_INCLUDE=$i/db4/db.h +- break +- elif test -f "$i/include/db5.1/db.h"; then +- THIS_PREFIX=$i +- THIS_INCLUDE=$i/include/db5.1/db.h +- break +- elif test -f "$i/include/db5.0/db.h"; then +- THIS_PREFIX=$i +- THIS_INCLUDE=$i/include/db5.0/db.h +- break +- elif test -f "$i/include/db4.8/db.h"; then +- THIS_PREFIX=$i +- THIS_INCLUDE=$i/include/db4.8/db.h +- break +- elif test -f "$i/include/db4.7/db.h"; then +- THIS_PREFIX=$i +- THIS_INCLUDE=$i/include/db4.7/db.h +- break +- elif test -f "$i/include/db4.6/db.h"; then +- THIS_PREFIX=$i +- THIS_INCLUDE=$i/include/db4.6/db.h +- break +- elif test -f "$i/include/db4.5/db.h"; then +- THIS_PREFIX=$i +- THIS_INCLUDE=$i/include/db4.5/db.h +- break +- elif test -f "$i/include/db4/db.h"; then +- THIS_PREFIX=$i +- THIS_INCLUDE=$i/include/db4/db.h +- break +- elif test -f "$i/include/db/db4.h"; then +- THIS_PREFIX=$i +- THIS_INCLUDE=$i/include/db/db4.h +- break +- elif test -f "$i/include/db4.h"; then +- THIS_PREFIX=$i +- THIS_INCLUDE=$i/include/db4.h +- break +- elif test -f "$i/include/db.h"; then ++ if test -f "$i/include/db.h"; then + THIS_PREFIX=$i + THIS_INCLUDE=$i/include/db.h + break + fi + done +- PHP_DBA_DB_CHECK(4, db-5.1 db-5.0 db-4.8 db-4.7 db-4.6 db-4.5 db-4.4 db-4.3 db-4.2 db-4.1 db-4.0 db-4 db4 db, [(void)db_create((DB**)0, (DB_ENV*)0, 0)]) ++ PHP_DBA_DB_CHECK(4, db, [(void)db_create((DB**)0, (DB_ENV*)0, 0)]) + fi + PHP_DBA_STD_RESULT(db4,Berkeley DB4) + +diff -up php-src-02be73b5fac63a02313b9fe0f204c65d4828edeb/ext/dba/dba.c.libdb php-src-02be73b5fac63a02313b9fe0f204c65d4828edeb/ext/dba/dba.c +--- php-src-02be73b5fac63a02313b9fe0f204c65d4828edeb/ext/dba/dba.c.libdb 2015-03-25 07:01:04.000000000 +0100 ++++ php-src-02be73b5fac63a02313b9fe0f204c65d4828edeb/ext/dba/dba.c 2015-03-25 08:41:34.871061250 +0100 +@@ -52,6 +52,10 @@ + #include "php_qdbm.h" + #include "php_tcadb.h" + ++#ifdef DB4_INCLUDE_FILE ++#include DB4_INCLUDE_FILE ++#endif ++ + /* {{{ arginfo */ + ZEND_BEGIN_ARG_INFO_EX(arginfo_dba_popen, 0, 0, 2) + ZEND_ARG_INFO(0, path) +@@ -537,6 +541,10 @@ PHP_MINFO_FUNCTION(dba) + + php_info_print_table_start(); + php_info_print_table_row(2, "DBA support", "enabled"); ++#ifdef DB_VERSION_STRING ++ php_info_print_table_row(2, "libdb header version", DB_VERSION_STRING); ++ php_info_print_table_row(2, "libdb library version", db_version(NULL, NULL, NULL)); ++#endif + if (handlers.s) { + smart_str_0(&handlers); + php_info_print_table_row(2, "Supported handlers", handlers.s->val); diff --git a/php-7.0.0-odbctimer.patch b/php-7.0.0-odbctimer.patch new file mode 100644 index 0000000..6f43dcd --- /dev/null +++ b/php-7.0.0-odbctimer.patch @@ -0,0 +1,45 @@ +diff -up php-src-02be73b5fac63a02313b9fe0f204c65d4828edeb/ext/odbc/php_odbc.c.odbctimer php-src-02be73b5fac63a02313b9fe0f204c65d4828edeb/ext/odbc/php_odbc.c +--- php-src-02be73b5fac63a02313b9fe0f204c65d4828edeb/ext/odbc/php_odbc.c.odbctimer 2015-03-25 07:01:04.000000000 +0100 ++++ php-src-02be73b5fac63a02313b9fe0f204c65d4828edeb/ext/odbc/php_odbc.c 2015-03-25 08:45:27.265011747 +0100 +@@ -431,7 +431,8 @@ static void _free_odbc_result(zend_resou + efree(res->values); + res->values = NULL; + } +- if (res->stmt) { ++ /* If aborted via timer expiration, don't try to call any unixODBC function */ ++ if (res->stmt && !(PG(connection_status) & PHP_CONNECTION_TIMEOUT)) { + #if defined(HAVE_SOLID) || defined(HAVE_SOLID_30) || defined(HAVE_SOLID_35) + SQLTransact(res->conn_ptr->henv, res->conn_ptr->hdbc, + (SQLUSMALLINT) SQL_COMMIT); +@@ -481,9 +482,12 @@ static void _close_odbc_conn(zend_resour + } + } ZEND_HASH_FOREACH_END(); + +- safe_odbc_disconnect(conn->hdbc); +- SQLFreeConnect(conn->hdbc); +- SQLFreeEnv(conn->henv); ++ /* If aborted via timer expiration, don't try to call any unixODBC function */ ++ if (!(PG(connection_status) & PHP_CONNECTION_TIMEOUT)) { ++ safe_odbc_disconnect(conn->hdbc); ++ SQLFreeConnect(conn->hdbc); ++ SQLFreeEnv(conn->henv); ++ } + efree(conn); + ODBCG(num_links)--; + } +@@ -506,9 +510,12 @@ static void _close_odbc_pconn(zend_resou + } + } ZEND_HASH_FOREACH_END(); + +- safe_odbc_disconnect(conn->hdbc); +- SQLFreeConnect(conn->hdbc); +- SQLFreeEnv(conn->henv); ++ /* If aborted via timer expiration, don't try to call any unixODBC function */ ++ if (!(PG(connection_status) & PHP_CONNECTION_TIMEOUT)) { ++ safe_odbc_disconnect(conn->hdbc); ++ SQLFreeConnect(conn->hdbc); ++ SQLFreeEnv(conn->henv); ++ } + free(conn); + + ODBCG(num_links)--; diff --git a/php-7.0.0-systzdata-v11.patch b/php-7.0.0-systzdata-v11.patch new file mode 100644 index 0000000..8d1fd05 --- /dev/null +++ b/php-7.0.0-systzdata-v11.patch @@ -0,0 +1,646 @@ +Add support for use of the system timezone database, rather +than embedding a copy. Discussed upstream but was not desired. + +History: +r11: use canonical names to avoid more case sensitivity issues + round lat/long from zone.tab towards zero per builtin db +r10: make timezone case insensitive +r9: fix another compile error without --with-system-tzdata configured (Michael Heimpold) +r8: fix compile error without --with-system-tzdata configured +r7: improve check for valid timezone id to exclude directories +r6: fix fd leak in r5, fix country code/BC flag use in + timezone_identifiers_list() using system db, + fix use of PECL timezonedb to override system db, +r5: reverts addition of "System/Localtime" fake tzname. + updated for 5.3.0, parses zone.tab to pick up mapping between + timezone name, country code and long/lat coords +r4: added "System/Localtime" tzname which uses /etc/localtime +r3: fix a crash if /usr/share/zoneinfo doesn't exist (Raphael Geissert) +r2: add filesystem trawl to set up name alias index +r1: initial revision + +diff -up php-src-02be73b5fac63a02313b9fe0f204c65d4828edeb/ext/date/lib/parse_tz.c.systzdata php-src-02be73b5fac63a02313b9fe0f204c65d4828edeb/ext/date/lib/parse_tz.c +--- php-src-02be73b5fac63a02313b9fe0f204c65d4828edeb/ext/date/lib/parse_tz.c.systzdata 2015-03-25 08:59:09.894376319 +0100 ++++ php-src-02be73b5fac63a02313b9fe0f204c65d4828edeb/ext/date/lib/parse_tz.c 2015-03-25 08:59:22.052426045 +0100 +@@ -20,6 +20,16 @@ + + #include "timelib.h" + ++#ifdef HAVE_SYSTEM_TZDATA ++#include ++#include ++#include ++#include ++#include ++ ++#include "php_scandir.h" ++#endif ++ + #include + + #ifdef HAVE_LOCALE_H +@@ -31,7 +41,12 @@ + #else + #include + #endif ++ ++#ifndef HAVE_SYSTEM_TZDATA + #include "timezonedb.h" ++#endif ++ ++#include + + #if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__)) + # if defined(__LITTLE_ENDIAN__) +@@ -51,6 +66,11 @@ + + static void read_preamble(const unsigned char **tzf, timelib_tzinfo *tz) + { ++ if (memcmp(tzf, "TZif", 4) == 0) { ++ *tzf += 20; ++ return; ++ } ++ + /* skip ID */ + *tzf += 4; + +@@ -256,7 +276,418 @@ void timelib_dump_tzinfo(timelib_tzinfo + } + } + +-static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const timelib_tzdb *tzdb) ++#ifdef HAVE_SYSTEM_TZDATA ++ ++#ifdef HAVE_SYSTEM_TZDATA_PREFIX ++#define ZONEINFO_PREFIX HAVE_SYSTEM_TZDATA_PREFIX ++#else ++#define ZONEINFO_PREFIX "/usr/share/zoneinfo" ++#endif ++ ++/* System timezone database pointer. */ ++static const timelib_tzdb *timezonedb_system; ++ ++/* Hash table entry for the cache of the zone.tab mapping table. */ ++struct location_info { ++ char code[2]; ++ double latitude, longitude; ++ char name[64]; ++ char *comment; ++ struct location_info *next; ++}; ++ ++/* Cache of zone.tab. */ ++static struct location_info **system_location_table; ++ ++/* Size of the zone.tab hash table; a random-ish prime big enough to ++ * prevent too many collisions. */ ++#define LOCINFO_HASH_SIZE (1021) ++ ++/* Compute a case insensitive hash of str */ ++static uint32_t tz_hash(const char *str) ++{ ++ const unsigned char *p = (const unsigned char *)str; ++ uint32_t hash = 5381; ++ int c; ++ ++ while ((c = tolower(*p++)) != '\0') { ++ hash = (hash << 5) ^ hash ^ c; ++ } ++ ++ return hash % LOCINFO_HASH_SIZE; ++} ++ ++/* Parse an ISO-6709 date as used in zone.tab. Returns end of the ++ * parsed string on success, or NULL on parse error. On success, ++ * writes the parsed number to *result. */ ++static char *parse_iso6709(char *p, double *result) ++{ ++ double v, sign; ++ char *pend; ++ size_t len; ++ ++ if (*p == '+') ++ sign = 1.0; ++ else if (*p == '-') ++ sign = -1.0; ++ else ++ return NULL; ++ ++ p++; ++ for (pend = p; *pend >= '0' && *pend <= '9'; pend++) ++ ;; ++ ++ /* Annoying encoding used by zone.tab has no decimal point, so use ++ * the length to determine the format: ++ * ++ * 4 = DDMM ++ * 5 = DDDMM ++ * 6 = DDMMSS ++ * 7 = DDDMMSS ++ */ ++ len = pend - p; ++ if (len < 4 || len > 7) { ++ return NULL; ++ } ++ ++ /* p => [D]DD */ ++ v = (p[0] - '0') * 10.0 + (p[1] - '0'); ++ p += 2; ++ if (len == 5 || len == 7) ++ v = v * 10.0 + (*p++ - '0'); ++ /* p => MM[SS] */ ++ v += (10.0 * (p[0] - '0') ++ + p[1] - '0') / 60.0; ++ p += 2; ++ /* p => [SS] */ ++ if (len > 5) { ++ v += (10.0 * (p[0] - '0') ++ + p[1] - '0') / 3600.0; ++ p += 2; ++ } ++ ++ /* Round to five decimal place, not because it's a good idea, ++ * but, because the builtin data uses rounded data, so, match ++ * that. */ ++ *result = trunc(v * sign * 100000.0) / 100000.0; ++ ++ return p; ++} ++ ++/* This function parses the zone.tab file to build up the mapping of ++ * timezone to country code and geographic location, and returns a ++ * hash table. The hash table is indexed by the function: ++ * ++ * tz_hash(timezone-name) ++ */ ++static struct location_info **create_location_table(void) ++{ ++ struct location_info **li, *i; ++ char zone_tab[PATH_MAX]; ++ char line[512]; ++ FILE *fp; ++ ++ strncpy(zone_tab, ZONEINFO_PREFIX "/zone.tab", sizeof zone_tab); ++ ++ fp = fopen(zone_tab, "r"); ++ if (!fp) { ++ return NULL; ++ } ++ ++ li = calloc(LOCINFO_HASH_SIZE, sizeof *li); ++ ++ while (fgets(line, sizeof line, fp)) { ++ char *p = line, *code, *name, *comment; ++ uint32_t hash; ++ double latitude, longitude; ++ ++ while (isspace(*p)) ++ p++; ++ ++ if (*p == '#' || *p == '\0' || *p == '\n') ++ continue; ++ ++ if (!isalpha(p[0]) || !isalpha(p[1]) || p[2] != '\t') ++ continue; ++ ++ /* code => AA */ ++ code = p; ++ p[2] = 0; ++ p += 3; ++ ++ /* coords => [+-][D]DDMM[SS][+-][D]DDMM[SS] */ ++ p = parse_iso6709(p, &latitude); ++ if (!p) { ++ continue; ++ } ++ p = parse_iso6709(p, &longitude); ++ if (!p) { ++ continue; ++ } ++ ++ if (!p || *p != '\t') { ++ continue; ++ } ++ ++ /* name = string */ ++ name = ++p; ++ while (*p != '\t' && *p && *p != '\n') ++ p++; ++ ++ *p++ = '\0'; ++ ++ /* comment = string */ ++ comment = p; ++ while (*p != '\t' && *p && *p != '\n') ++ p++; ++ ++ if (*p == '\n' || *p == '\t') ++ *p = '\0'; ++ ++ hash = tz_hash(name); ++ i = malloc(sizeof *i); ++ memcpy(i->code, code, 2); ++ strncpy(i->name, name, sizeof i->name); ++ i->comment = strdup(comment); ++ i->longitude = longitude; ++ i->latitude = latitude; ++ i->next = li[hash]; ++ li[hash] = i; ++ /* printf("%s [%u, %f, %f]\n", name, hash, latitude, longitude); */ ++ } ++ ++ fclose(fp); ++ ++ return li; ++} ++ ++/* Return location info from hash table, using given timezone name. ++ * Returns NULL if the name could not be found. */ ++const struct location_info *find_zone_info(struct location_info **li, ++ const char *name) ++{ ++ uint32_t hash = tz_hash(name); ++ const struct location_info *l; ++ ++ if (!li) { ++ return NULL; ++ } ++ ++ for (l = li[hash]; l; l = l->next) { ++ if (strcasecmp(l->name, name) == 0) ++ return l; ++ } ++ ++ return NULL; ++} ++ ++/* Filter out some non-tzdata files and the posix/right databases, if ++ * present. */ ++static int index_filter(const struct dirent *ent) ++{ ++ return strcmp(ent->d_name, ".") != 0 ++ && strcmp(ent->d_name, "..") != 0 ++ && strcmp(ent->d_name, "posix") != 0 ++ && strcmp(ent->d_name, "posixrules") != 0 ++ && strcmp(ent->d_name, "right") != 0 ++ && strstr(ent->d_name, ".tab") == NULL; ++} ++ ++static int sysdbcmp(const void *first, const void *second) ++{ ++ const timelib_tzdb_index_entry *alpha = first, *beta = second; ++ ++ return strcasecmp(alpha->id, beta->id); ++} ++ ++ ++/* Create the zone identifier index by trawling the filesystem. */ ++static void create_zone_index(timelib_tzdb *db) ++{ ++ size_t dirstack_size, dirstack_top; ++ size_t index_size, index_next; ++ timelib_tzdb_index_entry *db_index; ++ char **dirstack; ++ ++ /* LIFO stack to hold directory entries to scan; each slot is a ++ * directory name relative to the zoneinfo prefix. */ ++ dirstack_size = 32; ++ dirstack = malloc(dirstack_size * sizeof *dirstack); ++ dirstack_top = 1; ++ dirstack[0] = strdup(""); ++ ++ /* Index array. */ ++ index_size = 64; ++ db_index = malloc(index_size * sizeof *db_index); ++ index_next = 0; ++ ++ do { ++ struct dirent **ents; ++ char name[PATH_MAX], *top; ++ int count; ++ ++ /* Pop the top stack entry, and iterate through its contents. */ ++ top = dirstack[--dirstack_top]; ++ snprintf(name, sizeof name, ZONEINFO_PREFIX "/%s", top); ++ ++ count = php_scandir(name, &ents, index_filter, php_alphasort); ++ ++ while (count > 0) { ++ struct stat st; ++ const char *leaf = ents[count - 1]->d_name; ++ ++ snprintf(name, sizeof name, ZONEINFO_PREFIX "/%s/%s", ++ top, leaf); ++ ++ if (strlen(name) && stat(name, &st) == 0) { ++ /* Name, relative to the zoneinfo prefix. */ ++ const char *root = top; ++ ++ if (root[0] == '/') root++; ++ ++ snprintf(name, sizeof name, "%s%s%s", root, ++ *root ? "/": "", leaf); ++ ++ if (S_ISDIR(st.st_mode)) { ++ if (dirstack_top == dirstack_size) { ++ dirstack_size *= 2; ++ dirstack = realloc(dirstack, ++ dirstack_size * sizeof *dirstack); ++ } ++ dirstack[dirstack_top++] = strdup(name); ++ } ++ else { ++ if (index_next == index_size) { ++ index_size *= 2; ++ db_index = realloc(db_index, ++ index_size * sizeof *db_index); ++ } ++ ++ db_index[index_next++].id = strdup(name); ++ } ++ } ++ ++ free(ents[--count]); ++ } ++ ++ if (count != -1) free(ents); ++ free(top); ++ } while (dirstack_top); ++ ++ qsort(db_index, index_next, sizeof *db_index, sysdbcmp); ++ ++ db->index = db_index; ++ db->index_size = index_next; ++ ++ free(dirstack); ++} ++ ++#define FAKE_HEADER "1234\0??\1??" ++#define FAKE_UTC_POS (7 - 4) ++ ++/* Create a fake data segment for database 'sysdb'. */ ++static void fake_data_segment(timelib_tzdb *sysdb, ++ struct location_info **info) ++{ ++ size_t n; ++ char *data, *p; ++ ++ data = malloc(3 * sysdb->index_size + 7); ++ ++ p = mempcpy(data, FAKE_HEADER, sizeof(FAKE_HEADER) - 1); ++ ++ for (n = 0; n < sysdb->index_size; n++) { ++ const struct location_info *li; ++ timelib_tzdb_index_entry *ent; ++ ++ ent = (timelib_tzdb_index_entry *)&sysdb->index[n]; ++ ++ /* Lookup the timezone name in the hash table. */ ++ if (strcmp(ent->id, "UTC") == 0) { ++ ent->pos = FAKE_UTC_POS; ++ continue; ++ } ++ ++ li = find_zone_info(info, ent->id); ++ if (li) { ++ /* If found, append the BC byte and the ++ * country code; set the position for this ++ * section of timezone data. */ ++ ent->pos = (p - data) - 4; ++ *p++ = '\1'; ++ *p++ = li->code[0]; ++ *p++ = li->code[1]; ++ } ++ else { ++ /* If not found, the timezone data can ++ * point at the header. */ ++ ent->pos = 0; ++ } ++ } ++ ++ sysdb->data = (unsigned char *)data; ++} ++ ++/* Returns true if the passed-in stat structure describes a ++ * probably-valid timezone file. */ ++static int is_valid_tzfile(const struct stat *st) ++{ ++ return S_ISREG(st->st_mode) && st->st_size > 20; ++} ++ ++/* To allow timezone names to be used case-insensitively, find the ++ * canonical name for this timezone, if possible. */ ++static const char *canonical_tzname(const char *timezone) ++{ ++ if (timezonedb_system) { ++ timelib_tzdb_index_entry *ent, lookup; ++ ++ lookup.id = (char *)timezone; ++ ++ ent = bsearch(&lookup, timezonedb_system->index, ++ timezonedb_system->index_size, sizeof lookup, ++ sysdbcmp); ++ if (ent) { ++ return ent->id; ++ } ++ } ++ ++ return timezone; ++} ++ ++/* Return the mmap()ed tzfile if found, else NULL. On success, the ++ * length of the mapped data is placed in *length. */ ++static char *map_tzfile(const char *timezone, size_t *length) ++{ ++ char fname[PATH_MAX]; ++ struct stat st; ++ char *p; ++ int fd; ++ ++ if (timezone[0] == '\0' || strstr(timezone, "..") != NULL) { ++ return NULL; ++ } ++ ++ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", canonical_tzname(timezone)); ++ ++ fd = open(fname, O_RDONLY); ++ if (fd == -1) { ++ return NULL; ++ } else if (fstat(fd, &st) != 0 || !is_valid_tzfile(&st)) { ++ close(fd); ++ return NULL; ++ } ++ ++ *length = st.st_size; ++ p = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0); ++ close(fd); ++ ++ return p != MAP_FAILED ? p : NULL; ++} ++ ++#endif ++ ++static int inmem_seek_to_tz_position(const unsigned char **tzf, char *timezone, const timelib_tzdb *tzdb) + { + int left = 0, right = tzdb->index_size - 1; + #ifdef HAVE_SETLOCALE +@@ -295,36 +726,135 @@ static int seek_to_tz_position(const uns + return 0; + } + ++static int seek_to_tz_position(const unsigned char **tzf, char *timezone, ++ char **map, size_t *maplen, ++ const timelib_tzdb *tzdb) ++{ ++#ifdef HAVE_SYSTEM_TZDATA ++ if (tzdb == timezonedb_system) { ++ char *orig; ++ ++ orig = map_tzfile(timezone, maplen); ++ if (orig == NULL) { ++ return 0; ++ } ++ ++ (*tzf) = (unsigned char *)orig ; ++ *map = orig; ++ ++ return 1; ++ } ++ else ++#endif ++ { ++ return inmem_seek_to_tz_position(tzf, timezone, tzdb); ++ } ++} ++ + const timelib_tzdb *timelib_builtin_db(void) + { ++#ifdef HAVE_SYSTEM_TZDATA ++ if (timezonedb_system == NULL) { ++ timelib_tzdb *tmp = malloc(sizeof *tmp); ++ ++ tmp->version = "0.system"; ++ tmp->data = NULL; ++ create_zone_index(tmp); ++ system_location_table = create_location_table(); ++ fake_data_segment(tmp, system_location_table); ++ timezonedb_system = tmp; ++ } ++ ++ ++ return timezonedb_system; ++#else + return &timezonedb_builtin; ++#endif + } + + const timelib_tzdb_index_entry *timelib_timezone_builtin_identifiers_list(int *count) + { ++#ifdef HAVE_SYSTEM_TZDATA ++ *count = timezonedb_system->index_size; ++ return timezonedb_system->index; ++#else + *count = sizeof(timezonedb_idx_builtin) / sizeof(*timezonedb_idx_builtin); + return timezonedb_idx_builtin; ++#endif + } + + int timelib_timezone_id_is_valid(char *timezone, const timelib_tzdb *tzdb) + { + const unsigned char *tzf; +- return (seek_to_tz_position(&tzf, timezone, tzdb)); ++ ++#ifdef HAVE_SYSTEM_TZDATA ++ if (tzdb == timezonedb_system) { ++ char fname[PATH_MAX]; ++ struct stat st; ++ ++ if (timezone[0] == '\0' || strstr(timezone, "..") != NULL) { ++ return 0; ++ } ++ ++ if (system_location_table) { ++ if (find_zone_info(system_location_table, timezone) != NULL) { ++ /* found in cache */ ++ return 1; ++ } ++ } ++ ++ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", canonical_tzname(timezone)); ++ ++ return stat(fname, &st) == 0 && is_valid_tzfile(&st); ++ } ++#endif ++ ++ return (inmem_seek_to_tz_position(&tzf, timezone, tzdb)); + } + + timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb) + { + const unsigned char *tzf; ++ char *memmap = NULL; ++ size_t maplen; + timelib_tzinfo *tmp; + +- if (seek_to_tz_position(&tzf, timezone, tzdb)) { ++ if (seek_to_tz_position(&tzf, timezone, &memmap, &maplen, tzdb)) { + tmp = timelib_tzinfo_ctor(timezone); + + read_preamble(&tzf, tmp); + read_header(&tzf, tmp); + read_transistions(&tzf, tmp); + read_types(&tzf, tmp); +- read_location(&tzf, tmp); ++ ++#ifdef HAVE_SYSTEM_TZDATA ++ if (memmap) { ++ const struct location_info *li; ++ ++ /* TZif-style - grok the location info from the system database, ++ * if possible. */ ++ ++ if ((li = find_zone_info(system_location_table, timezone)) != NULL) { ++ tmp->location.comments = strdup(li->comment); ++ strncpy(tmp->location.country_code, li->code, 2); ++ tmp->location.longitude = li->longitude; ++ tmp->location.latitude = li->latitude; ++ tmp->bc = 1; ++ } ++ else { ++ strcpy(tmp->location.country_code, "??"); ++ tmp->bc = 0; ++ tmp->location.comments = strdup(""); ++ } ++ ++ /* Now done with the mmap segment - discard it. */ ++ munmap(memmap, maplen); ++ } else ++#endif ++ { ++ /* PHP-style - use the embedded info. */ ++ read_location(&tzf, tmp); ++ } + } else { + tmp = NULL; + } +diff -up php-src-02be73b5fac63a02313b9fe0f204c65d4828edeb/ext/date/lib/timelib.m4.systzdata php-src-02be73b5fac63a02313b9fe0f204c65d4828edeb/ext/date/lib/timelib.m4 +--- php-src-02be73b5fac63a02313b9fe0f204c65d4828edeb/ext/date/lib/timelib.m4.systzdata 2015-03-25 07:01:04.000000000 +0100 ++++ php-src-02be73b5fac63a02313b9fe0f204c65d4828edeb/ext/date/lib/timelib.m4 2015-03-25 08:56:30.412724035 +0100 +@@ -78,3 +78,17 @@ stdlib.h + + dnl Check for strtoll, atoll + AC_CHECK_FUNCS(strtoll atoll strftime) ++ ++PHP_ARG_WITH(system-tzdata, for use of system timezone data, ++[ --with-system-tzdata[=DIR] to specify use of system timezone data], ++no, no) ++ ++if test "$PHP_SYSTEM_TZDATA" != "no"; then ++ AC_DEFINE(HAVE_SYSTEM_TZDATA, 1, [Define if system timezone data is used]) ++ ++ if test "$PHP_SYSTEM_TZDATA" != "yes"; then ++ AC_DEFINE_UNQUOTED(HAVE_SYSTEM_TZDATA_PREFIX, "$PHP_SYSTEM_TZDATA", ++ [Define for location of system timezone data]) ++ fi ++fi ++ diff --git a/php.spec b/php.spec index 26eaf56..d1b6b99 100644 --- a/php.spec +++ b/php.spec @@ -12,21 +12,21 @@ %endif # API/ABI check -%global apiver 20131106 -%global zendver 20131226 -%global pdover 20080721 +%global apiver 20131218 +%global zendver 20141001 +%global pdover 20150127 # Extension version %global opcachever 7.0.4-dev %global oci8ver 2.0.9 # Use for first build of PHP (before pecl/zip and pecl/jsonc) -%global php_bootstrap 0 +%global php_bootstrap 1 # Adds -z now to the linker flags %global _hardened_build 1 # version used for php embedded library soname -%global embed_version 5.6 +%global embed_version 7.0 # Ugly hack. Harcoded values to avoid relocation. %global _httpd_mmn %(cat %{_root_includedir}/httpd/.mmn 2>/dev/null || echo 0) @@ -66,7 +66,8 @@ %global mysql_config %{_root_libdir}/mysql/mysql_config # Optional components; pass "--with mssql" etc to rpmbuild. -%global with_oci8 %{?_with_oci8:1}%{!?_with_oci8:0} +#global with_oci8 %{?_with_oci8:1}%{!?_with_oci8:0} +%global with_oci8 0 %global with_imap 1 %global with_interbase 1 @@ -127,12 +128,18 @@ %global db_devel libdb-devel %endif -#global rcver RC1 +%global gh_commit 23336d77a61eecb1130b7dedb2cdc40b4f0c8eea +%global gh_short %(c=%{gh_commit}; echo ${c:0:7}) +%global gh_date 20150325 +%global gh_owner php +%global gh_project php-src +#global rcver RC1 + Summary: PHP scripting language for creating dynamic web sites Name: %{?scl_prefix}php -Version: 5.6.7 -Release: 1%{?dist} +Version: 7.0.0 +Release: 0.1.%{gh_date}git%{gh_short}%{?dist} # All files licensed under PHP version 3.01, except # Zend is licensed under Zend # TSRM is licensed under BSD @@ -140,7 +147,11 @@ License: PHP and Zend and BSD Group: Development/Languages URL: http://www.php.net/ -Source0: php-%{version}%{?rcver}-strip.tar.xz +%if 0%{?gh_date} +Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}%{?prever}%{?gh_short:-%{gh_short}}.tar.gz +%else +Source0: http://www.php.net/distributions/php-%{version}%{?rcver}.tar.bz2 +%endif Source1: php.conf Source2: php.ini Source3: macros.php @@ -158,24 +169,24 @@ Source50: opcache.ini Source51: opcache-default.blacklist # Build fixes -Patch5: php-5.6.3-includedir.patch +Patch5: php-7.0.0-includedir.patch Patch6: php-5.6.3-embed.patch Patch7: php-5.3.0-recode.patch -Patch8: php-5.6.3-libdb.patch +Patch8: php-7.0.0-libdb.patch # Fixes for extension modules # https://bugs.php.net/63171 no odbc call during timeout -Patch21: php-5.4.7-odbctimer.patch +Patch21: php-7.0.0-odbctimer.patch # Functional changes -Patch40: php-5.4.0-dlopen.patch -Patch42: php-5.6.3-systzdata-v11.patch +Patch40: php-7.0.0-dlopen.patch +Patch42: php-7.0.0-systzdata-v11.patch # See http://bugs.php.net/53436 Patch43: php-5.4.0-phpize.patch # Use -lldap_r for OpenLDAP Patch45: php-5.6.3-ldap_r.patch # Make php_config.h constant across builds -Patch46: php-5.6.3-fixheader.patch +Patch46: php-7.0.0-fixheader.patch # drop "Configure command" from phpinfo output Patch47: php-5.6.3-phpinfo.patch @@ -218,6 +229,7 @@ BuildRequires: libtool-ltdl-devel %if %{with_dtrace} BuildRequires: systemtap-sdt-devel %endif +BuildRequires: bison Requires: httpd-mmn = %{_httpd_mmn} Provides: %{?scl_prefix}mod_php = %{version}-%{release} Requires: %{?scl_prefix}php-common%{?_isa} = %{version}-%{release} @@ -232,7 +244,7 @@ Requires(pre): httpd # Don't provides extensions, or shared libraries (embedded) -%{?filter_from_requires: %filter_from_requires /libphp5.*so/d} +%{?filter_from_requires: %filter_from_requires /libphp7.*so/d} %{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$} %{?filter_setup} @@ -355,7 +367,6 @@ Provides: %{?scl_prefix}php-core = %{version}, %{?scl_prefix}php-core%{?_isa} = Provides: %{?scl_prefix}php-ctype, %{?scl_prefix}php-ctype%{?_isa} Provides: %{?scl_prefix}php-curl, %{?scl_prefix}php-curl%{?_isa} Provides: %{?scl_prefix}php-date, %{?scl_prefix}php-date%{?_isa} -Provides: %{?scl_prefix}php-ereg, %{?scl_prefix}php-ereg%{?_isa} Provides: %{?scl_prefix}php-exif, %{?scl_prefix}php-exif%{?_isa} Provides: %{?scl_prefix}php-fileinfo, %{?scl_prefix}php-fileinfo%{?_isa} Provides: %{?scl_prefix}php-filter, %{?scl_prefix}php-filter%{?_isa} @@ -480,12 +491,9 @@ Group: Development/Languages License: PHP Requires: %{?scl_prefix}php-pdo%{?_isa} = %{version}-%{release} Provides: %{?scl_prefix}php_database -Provides: %{?scl_prefix}php-mysql = %{version}-%{release} -Provides: %{?scl_prefix}php-mysql%{?_isa} = %{version}-%{release} Provides: %{?scl_prefix}php-mysqli = %{version}-%{release} Provides: %{?scl_prefix}php-mysqli%{?_isa} = %{version}-%{release} Provides: %{?scl_prefix}php-pdo_mysql, %{?scl_prefix}php-pdo_mysql%{?_isa} -Obsoletes: %{?scl_prefix}php-mysql < %{version} %description mysqlnd The %{?scl_prefix}php-mysqlnd package contains a dynamic shared object that will add @@ -782,21 +790,19 @@ support for using the tidy library to PHP. %endif %if %{with_freetds} -%package mssql -Summary: MSSQL database module for PHP +%package pdo-dblib +Summary: PDO driver Microsoft SQL Server and Sybase databases Group: Development/Languages # All files licensed under PHP version 3.01 License: PHP Requires: %{?scl_prefix}php-pdo%{?_isa} = %{version}-%{release} BuildRequires: freetds-devel Provides: %{?scl_prefix}php-pdo_dblib, %{?scl_prefix}php-pdo_dblib%{?_isa} -Provides: %{?scl_prefix}php-sybase_ct, %{?scl_prefix}php-sybase_ct%{?_isa} -%description mssql -The %{?scl_prefix}php-mssql package contains a dynamic shared object that will -add MSSQL and Sybase database support to PHP. It uses the TDS (Tabular -DataStream) protocol through the freetds library, hence any -database server which supports TDS can be accessed. +%description pdo-dblib +The %{?scl_prefix}php-pdo-dblib package contains a dynamic shared object +that implements the PHP Data Objects (PDO) interface to enable access from +PHP to Microsoft SQL Server and Sybase databases through the FreeTDS libary. %endif %package pspell @@ -855,8 +861,11 @@ support for using the enchant library to PHP. %prep : Building %{name}-%{version}-%{release} with systemd=%{with_systemd} imap=%{with_imap} interbase=%{with_interbase} mcrypt=%{with_mcrypt} freetds=%{with_freetds} sqlite3=%{with_sqlite3} tidy=%{with_tidy} zip=%{with_zip} - +%if 0%{?gh_date} +%setup -q -n %{gh_project}-%{gh_commit} +%else %setup -q -n php-%{version}%{?rcver} +%endif %patch5 -p1 -b .includedir %patch6 -p1 -b .embed @@ -892,7 +901,6 @@ support for using the enchant library to PHP. # Prevent %%doc confusion over LICENSE files cp Zend/LICENSE Zend/ZEND_LICENSE cp TSRM/LICENSE TSRM_LICENSE -cp ext/ereg/regex/COPYRIGHT regex_COPYRIGHT %if ! %{with_libgd} cp ext/gd/libgd/README libgd_README cp ext/gd/libgd/COPYING libgd_COPYING @@ -922,8 +930,8 @@ rm Zend/tests/bug54268.phpt # Safety check for API version change. pver=$(sed -n '/#define PHP_VERSION /{s/.* "//;s/".*$//;p}' main/php_version.h) -if test "x${pver}" != "x%{version}%{?rcver}"; then - : Error: Upstream PHP version is now ${pver}, expecting %{version}%{?rcver}. +if test "x${pver}" != "x%{version}%{?rcver}%{?gh_date:-dev}"; then + : Error: Upstream PHP version is now ${pver}, expecting %{version}%{?rcver}%{?gh_date:-dev}. : Update the version/rcver macros and rebuild. exit 1 fi @@ -1005,17 +1013,20 @@ sed -e 's:%{_root_sysconfdir}:%{_sysconfdir}:' \ %build # aclocal workaround - to be improved %if 0%{?fedora} >= 11 || 0%{?rhel} >= 6 -cat `aclocal --print-ac-dir`/{libtool,ltoptions,ltsugar,ltversion,lt~obsolete}.m4 >>aclocal.m4 +cat $(aclocal --print-ac-dir)/{libtool,ltoptions,ltsugar,ltversion,lt~obsolete}.m4 >>aclocal.m4 %endif # Force use of system libtool: libtoolize --force --copy %if 0%{?fedora} >= 11 || 0%{?rhel} >= 6 -cat `aclocal --print-ac-dir`/{libtool,ltoptions,ltsugar,ltversion,lt~obsolete}.m4 >build/libtool.m4 +cat $(aclocal --print-ac-dir)/{libtool,ltoptions,ltsugar,ltversion,lt~obsolete}.m4 >build/libtool.m4 %else -cat `aclocal --print-ac-dir`/libtool.m4 > build/libtool.m4 +cat $(aclocal --print-ac-dir)/libtool.m4 > build/libtool.m4 %endif +# Bison files +./genfiles + # Regenerate configure scripts (patches change config.m4's) touch configure.in ./buildconf --force @@ -1038,7 +1049,7 @@ build() { mkdir Zend && cp ../Zend/zend_{language,ini}_{parser,scanner}.[ch] Zend # Always static: -# date, ereg, filter, libxml, reflection, spl: not supported +# date, filter, libxml, reflection, spl: not supported # hash: for PHAR_SIG_SHA256 and PHAR_SIG_SHA512 # session: dep on hash, used by soap and wddx # pcre: used by filter, zip @@ -1126,7 +1137,6 @@ build --libdir=%{_libdir}/php \ --with-xmlrpc=shared \ --with-ldap=shared --with-ldap-sasl \ --enable-mysqlnd=shared \ - --with-mysql=shared,mysqlnd \ --with-mysqli=shared,mysqlnd \ --with-mysql-sock=%{mysql_sock} \ %if %{with_oci8} @@ -1171,9 +1181,7 @@ build --libdir=%{_libdir}/php \ --with-tidy=shared,%{_root_prefix} \ %endif %if %{with_freetds} - --with-mssql=shared,%{_root_prefix} \ --with-pdo-dblib=shared,%{_root_prefix} \ - --with-sybase-ct=shared,%{_root_prefix} \ %endif --enable-sysvmsg=shared --enable-sysvshm=shared --enable-sysvsem=shared \ --enable-shmop=shared \ @@ -1209,7 +1217,7 @@ build --with-apxs2=%{_httpd_apxs} \ %if %{with_lsws} --with-litespeed \ %endif - --without-mysql \ + --without-mysqli \ --disable-pdo \ ${without_shared} popd @@ -1222,16 +1230,16 @@ build --enable-fpm \ %endif --with-fpm-acl \ --libdir=%{_libdir}/php \ - --without-mysql \ + --without-mysqli \ --disable-pdo \ ${without_shared} popd # Build for inclusion as embedded script language into applications, -# /usr/lib[64]/libphp5.so +# /usr/lib[64]/libphp7.so pushd build-embedded build --enable-embed \ - --without-mysql \ + --without-mysqli \ --disable-pdo \ ${without_shared} popd @@ -1284,18 +1292,18 @@ install -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/php.ini # For third-party packaging: install -m 755 -d $RPM_BUILD_ROOT%{_datadir}/php -sed -e 's/libphp5/lib%{name}5/' %{SOURCE9} >modconf +sed -e 's/libphp7/lib%{name}/' %{SOURCE9} >modconf # install the DSO install -m 755 -d $RPM_BUILD_ROOT%{_httpd_moddir} -install -m 755 build-apache/libs/libphp5.so $RPM_BUILD_ROOT%{_httpd_moddir} +install -m 755 build-apache/libs/libphp7.so $RPM_BUILD_ROOT%{_httpd_moddir} # Apache config fragment install -m 755 -d $RPM_BUILD_ROOT%{_httpd_contentdir}/icons install -m 644 php.gif $RPM_BUILD_ROOT%{_httpd_contentdir}/icons/%{name}.gif %if %{?scl:1}0 install -m 755 -d $RPM_BUILD_ROOT%{_root_httpd_moddir} -ln -s %{_httpd_moddir}/libphp5.so $RPM_BUILD_ROOT%{_root_httpd_moddir}/lib%{name}5.so +ln -s %{_httpd_moddir}/libphp7.so $RPM_BUILD_ROOT%{_root_httpd_moddir}/lib%{name}.so %endif %if "%{_httpd_modconfdir}" == "%{_httpd_confdir}" @@ -1339,6 +1347,7 @@ sed -e 's:/var/lib:%{_localstatedir}/lib:' \ -e 's:/var/log:%{_localstatedir}/log:' \ -i $RPM_BUILD_ROOT%{_sysconfdir}/php-fpm.d/www.conf mv $RPM_BUILD_ROOT%{_sysconfdir}/php-fpm.conf.default . +mv $RPM_BUILD_ROOT%{_sysconfdir}/php-fpm.d/www.conf.default . # tmpfiles.d # install -m 755 -d $RPM_BUILD_ROOT%{_prefix}/lib/tmpfiles.d # install -m 644 php-fpm.tmpfiles $RPM_BUILD_ROOT%{_prefix}/lib/tmpfiles.d/php-fpm.conf @@ -1397,7 +1406,7 @@ ln -s %{_bindir}/lsphp $RPM_BUILD_ROOT%{_root_bindir}/ls%{scl} # Generate files lists and stub .ini files for each subpackage for mod in pgsql odbc ldap snmp xmlrpc \ - mysqlnd mysql mysqli pdo_mysql \ + mysqlnd mysqli pdo_mysql \ %if %{with_imap} imap \ %endif @@ -1425,7 +1434,7 @@ for mod in pgsql odbc ldap snmp xmlrpc \ tidy \ %endif %if %{with_freetds} - pdo_dblib mssql sybase_ct \ + pdo_dblib \ %endif %if %{with_recode} recode \ @@ -1441,7 +1450,7 @@ do opcache) # Zend extensions ini=10-${mod}.ini;; - pdo_*|mysql|mysqli|wddx|xmlreader|xmlrpc) + pdo_*|mysqli|wddx|xmlreader|xmlrpc) # Extensions with dependencies on 20-* ini=30-${mod}.ini;; *) @@ -1468,16 +1477,11 @@ cat files.dom files.xsl files.xml{reader,writer} files.wddx \ files.simplexml >> files.xml # mysqlnd -cat files.mysql \ - files.mysqli \ +cat files.mysqli \ files.pdo_mysql \ >> files.mysqlnd # Split out the PDO modules -%if %{with_freetds} -cat files.pdo_dblib >> files.mssql -cat files.sybase_ct >> files.mssql -%endif cat files.pdo_pgsql >> files.pgsql cat files.pdo_odbc >> files.odbc %if %{with_oci8} @@ -1517,7 +1521,7 @@ install -m 644 -D macros.php \ rm -rf $RPM_BUILD_ROOT%{_libdir}/php/modules/*.a \ $RPM_BUILD_ROOT%{_bindir}/{phptar} \ $RPM_BUILD_ROOT%{_datadir}/pear \ - $RPM_BUILD_ROOT%{_libdir}/libphp5.la + $RPM_BUILD_ROOT%{_libdir}/libphp7.la # Remove irrelevant docs rm -f README.{Zeus,QNX,CVS-RULES} @@ -1606,11 +1610,11 @@ fi %files %defattr(-,root,root) -%{_httpd_moddir}/libphp5.so +%{_httpd_moddir}/libphp7.so %if 0%{?scl:1} %dir %{_libdir}/httpd %dir %{_libdir}/httpd/modules -%{_root_httpd_moddir}/lib%{name}5.so +%{_root_httpd_moddir}/lib%{name}.so %endif %attr(0770,root,apache) %dir %{_localstatedir}/lib/php/session %attr(0770,root,apache) %dir %{_localstatedir}/lib/php/wsdlcache @@ -1623,7 +1627,7 @@ fi %files common -f files.common %defattr(-,root,root) %doc CODING_STANDARDS CREDITS EXTENSIONS NEWS README* -%license LICENSE Zend/ZEND_* TSRM_LICENSE regex_COPYRIGHT +%license LICENSE Zend/ZEND_* TSRM_LICENSE %license libmagic_LICENSE %license phar_LICENSE %doc php.ini-* @@ -1665,7 +1669,7 @@ fi %files fpm %defattr(-,root,root) -%doc php-fpm.conf.default +%doc php-fpm.conf.default www.conf.default %license fpm_LICENSE %attr(0770,root,apache) %dir %{_localstatedir}/lib/php/session %attr(0770,root,apache) %dir %{_localstatedir}/lib/php/wsdlcache @@ -1703,8 +1707,8 @@ fi %files embedded %defattr(-,root,root,-) -%{_libdir}/libphp5.so -%{_libdir}/libphp5-%{embed_version}.so +%{_libdir}/libphp7.so +%{_libdir}/libphp7-%{embed_version}.so %files devel %defattr(-,root,root) @@ -1748,7 +1752,7 @@ fi %files tidy -f files.tidy %endif %if %{with_freetds} -%files mssql -f files.mssql +%files pdo-dblib -f files.pdo_dblib %endif %files pspell -f files.pspell %files intl -f files.intl @@ -1771,6 +1775,12 @@ fi %changelog +* Wed Mar 25 2015 Remi Collet 7.0.0-0.1.20150325git23336d7 +- update for php 7.0.0 +- ereg, mssql, mysql and sybase_ct extensions are removed +- add pdo-dblib subpackage (instead of php-mssql) +- disable oci8 extension, not adapted for 7.0 + * Thu Mar 19 2015 Remi Collet 5.6.7-1 - Update to 5.6.7 http://www.php.net/releases/5_6_7.php -- cgit