summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apcu-upstream.patch37
-rw-r--r--php-pecl-apcu-php7.spec12
2 files changed, 44 insertions, 5 deletions
diff --git a/apcu-upstream.patch b/apcu-upstream.patch
new file mode 100644
index 0000000..72e15fd
--- /dev/null
+++ b/apcu-upstream.patch
@@ -0,0 +1,37 @@
+From 563c4573d439d5371f7f331b5117b7e6b648ed17 Mon Sep 17 00:00:00 2001
+From: Tyson Andre <tysonandre775@hotmail.com>
+Date: Sun, 24 Jul 2016 19:05:10 -0700
+Subject: [PATCH] Fixes #188: Fix Segfault in ZTS build when locking
+
+In ZTS builds with static TSRMLS,
+blocking interruptions requires TSRMLS to be initialized.
+
+(WLOCK will block signal interruptions, then acquire a lock)
+
+The code initialized it in RINIT (per-request), but did not initialize
+it in MINIT(module init).
+But module init needed to lock in order to not be interrupted while
+allocating an arena in shared memory.
+
+Fixed this by calling ZEND_TSRMLS_CACHE_UPDATE();
+
+Other extensions do this in MINIT in both php-7.0 and php-7.1
+E.g. https://github.com/php/php-src/blob/PHP-7.0.9/ext/mbstring/mbstring.c#L1550
+---
+ php_apc.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/php_apc.c b/php_apc.c
+index 83fd758..d79338e 100644
+--- a/php_apc.c
++++ b/php_apc.c
+@@ -210,6 +210,9 @@ static PHP_MINFO_FUNCTION(apcu)
+ /* {{{ PHP_MINIT_FUNCTION(apcu) */
+ static PHP_MINIT_FUNCTION(apcu)
+ {
++#if defined(ZTS) && defined(COMPILE_DL_APCU)
++ ZEND_TSRMLS_CACHE_UPDATE();
++#endif
+ ZEND_INIT_MODULE_GLOBALS(apcu, php_apc_init_globals, NULL);
+
+ REGISTER_INI_ENTRIES();
diff --git a/php-pecl-apcu-php7.spec b/php-pecl-apcu-php7.spec
index 3ad0ce6..088067b 100644
--- a/php-pecl-apcu-php7.spec
+++ b/php-pecl-apcu-php7.spec
@@ -21,11 +21,7 @@
%global gh_project apcu
#global gh_date 20151205
%global pecl_name apcu
-%if "%{php_version}" > "7.1"
-%global with_zts 0
-%else
%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}}
-%endif
%global ini_name 40-%{pecl_name}.ini
Name: %{?sub_prefix}php-pecl-apcu
@@ -35,13 +31,15 @@ Version: 5.1.5
Release: 0.2.%{gh_date}git%{gh_short}%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{pecl_name}-%{version}-%{gh_short}.tar.gz
%else
-Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+Release: 3%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz
%endif
Source1: %{pecl_name}-5.1.2.ini
Source2: %{pecl_name}-panel.conf
Source3: %{pecl_name}.conf.php
+Patch0: %{pecl_name}-upstream.patch
+
License: PHP
Group: Development/Languages
URL: http://pecl.php.net/package/APCu
@@ -155,6 +153,7 @@ mv %{pecl_name}-%{version} NTS
%{?_licensedir:sed -e '/LICENSE/s/role="doc"/role="src"/' -i package.xml}
cd NTS
+%patch0 -p1 -b .upstream
# Sanity check, really often broken
extver=$(sed -n '/#define PHP_APCU_VERSION/{s/.* "//;s/".*$//;p}' php_apc.h)
@@ -316,6 +315,9 @@ fi
%changelog
+* Mon Jul 25 2016 Remi Collet <remi@fedoraproject.org> - 5.1.5-3
+- add patch for PHP 7.1 and ZTS
+
* Sat Jul 23 2016 Remi Collet <remi@fedoraproject.org> - 5.1.5-2
- disable ZTS build with PHP 7.1