summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2018-06-28 15:04:16 +0200
committerRemi Collet <remi@remirepo.net>2018-06-28 15:04:16 +0200
commitda12d6eef4de8315b49a0f135cb3d842b5cf58fa (patch)
tree29e69f0c745b7d3e6c3f9cf06e023f004c074db7
parent5e8ad79f04a3724e73c8fd4c3cde207d821d12c1 (diff)
add patch for PHP 7.3 from https://github.com/laruence/yac/pull/89
-rw-r--r--89.patch131
-rw-r--r--PHPINFO15
-rw-r--r--REFLECTION2
-rw-r--r--php-pecl-yac.spec26
4 files changed, 163 insertions, 11 deletions
diff --git a/89.patch b/89.patch
new file mode 100644
index 0000000..308b35f
--- /dev/null
+++ b/89.patch
@@ -0,0 +1,131 @@
+From a95c132cad71fa6ab52fa5b4062b8dba7a17458b Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Thu, 28 Jun 2018 14:43:21 +0200
+Subject: [PATCH 1/3] fix for PHP 7.3
+
+---
+ yac.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/yac.c b/yac.c
+index 807d349..c234daf 100644
+--- a/yac.c
++++ b/yac.c
+@@ -147,7 +147,9 @@ static int yac_add_impl(zend_string *prefix, zend_string *key, zval *value, int
+ ret = yac_storage_update(ZSTR_VAL(key), ZSTR_LEN(key), (char *)&Z_DVAL_P(value), sizeof(double), flag, ttl, add, tv);
+ break;
+ case IS_STRING:
++#if PHP_VERSION_ID < 70300
+ case IS_CONSTANT:
++#endif
+ {
+ if (Z_STRLEN_P(value) > YAC_G(compress_threshold) || Z_STRLEN_P(value) > YAC_STORAGE_MAX_ENTRY_LEN) {
+ int compressed_len;
+@@ -347,7 +349,9 @@ static zval * yac_get_impl(zend_string *prefix, zend_string *key, uint32_t *cas,
+ efree(data);
+ break;
+ case IS_STRING:
++#if PHP_VERSION_ID < 70300
+ case IS_CONSTANT:
++#endif
+ {
+ if ((flag & YAC_ENTRY_COMPRESSED)) {
+ size_t orig_len = ((uint32_t)flag >> YAC_ENTRY_ORIG_LEN_SHIT);
+
+From 6d067e07b31b6b805210c29894c73c21207dd70d Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Thu, 28 Jun 2018 14:54:52 +0200
+Subject: [PATCH 2/3] fix [-Wformat] warnings
+
+---
+ yac.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/yac.c b/yac.c
+index c234daf..141833c 100644
+--- a/yac.c
++++ b/yac.c
+@@ -157,7 +157,7 @@ static int yac_add_impl(zend_string *prefix, zend_string *key, zval *value, int
+
+ /* if longer than this, then we can not stored the length in flag */
+ if (Z_STRLEN_P(value) > YAC_ENTRY_MAX_ORIG_LEN) {
+- php_error_docref(NULL, E_WARNING, "Value is too long(%d bytes) to be stored", Z_STRLEN_P(value));
++ php_error_docref(NULL, E_WARNING, "Value is too long(%ld bytes) to be stored", Z_STRLEN_P(value));
+ if (prefix->len) {
+ zend_string_release(prefix_key);
+ }
+@@ -176,7 +176,7 @@ static int yac_add_impl(zend_string *prefix, zend_string *key, zval *value, int
+ }
+
+ if (compressed_len > YAC_STORAGE_MAX_ENTRY_LEN) {
+- php_error_docref(NULL, E_WARNING, "Value is too long(%d bytes) to be stored", Z_STRLEN_P(value));
++ php_error_docref(NULL, E_WARNING, "Value is too long(%ld bytes) to be stored", Z_STRLEN_P(value));
+ efree(compressed);
+ if (prefix->len) {
+ zend_string_release(prefix_key);
+@@ -1015,13 +1015,13 @@ PHP_MINFO_FUNCTION(yac)
+ php_info_print_table_row(2, "Total Shared Memory Usage for keys(keys_memory_size)", buf);
+ snprintf(buf, sizeof(buf), "%ld", inf->v_msize);
+ php_info_print_table_row(2, "Total Shared Memory Usage for values(values_memory_size)", buf);
+- snprintf(buf, sizeof(buf), "%ld", inf->segment_size);
++ snprintf(buf, sizeof(buf), "%d", inf->segment_size);
+ php_info_print_table_row(2, "Size of Shared Memory Segment(segment_size)", buf);
+- snprintf(buf, sizeof(buf), "%ld", inf->segments_num);
++ snprintf(buf, sizeof(buf), "%d", inf->segments_num);
+ php_info_print_table_row(2, "Number of Segments (segment_num)", buf);
+- snprintf(buf, sizeof(buf), "%ld", inf->slots_size);
++ snprintf(buf, sizeof(buf), "%d", inf->slots_size);
+ php_info_print_table_row(2, "Total Slots Number(slots_size)", buf);
+- snprintf(buf, sizeof(buf), "%ld", inf->slots_num);
++ snprintf(buf, sizeof(buf), "%d", inf->slots_num);
+ php_info_print_table_row(2, "Total Used Slots(slots_num)", buf);
+ php_info_print_table_end();
+
+
+From 7fe254cb17a9b2f17bebd3b032f1d12870c2e4ab Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Thu, 28 Jun 2018 14:57:57 +0200
+Subject: [PATCH 3/3] fix warnings to make gcc happy [-Wmaybe-uninitialized]
+ and [-Wunused-variable]
+
+---
+ storage/allocator/yac_allocator.c | 3 ---
+ yac.c | 4 ++--
+ 2 files changed, 2 insertions(+), 5 deletions(-)
+
+diff --git a/storage/allocator/yac_allocator.c b/storage/allocator/yac_allocator.c
+index 610616f..6f2024c 100644
+--- a/storage/allocator/yac_allocator.c
++++ b/storage/allocator/yac_allocator.c
+@@ -24,9 +24,6 @@
+ #include "storage/yac_storage.h"
+ #include "yac_allocator.h"
+
+-static const yac_shared_memory_handlers *shared_memory_handler = NULL;
+-static const char *shared_model;
+-
+ int yac_allocator_startup(unsigned long k_size, unsigned long size, char **msg) /* {{{ */ {
+ char *p;
+ yac_shared_segment *segments = NULL;
+diff --git a/yac.c b/yac.c
+index 141833c..56bbc4e 100644
+--- a/yac.c
++++ b/yac.c
+@@ -120,7 +120,7 @@ static int yac_add_impl(zend_string *prefix, zend_string *key, zval *value, int
+ int ret = 0, flag = Z_TYPE_P(value);
+ char *msg;
+ time_t tv;
+- zend_string *prefix_key;
++ zend_string *prefix_key = NULL;
+
+ if ((ZSTR_LEN(key) + prefix->len) > YAC_STORAGE_MAX_KEY_LEN) {
+ php_error_docref(NULL, E_WARNING, "Key%s can not be longer than %d bytes",
+@@ -302,7 +302,7 @@ static zval * yac_get_impl(zend_string *prefix, zend_string *key, uint32_t *cas,
+ uint32_t flag, size = 0;
+ char *data, *msg;
+ time_t tv;
+- zend_string *prefix_key;
++ zend_string *prefix_key = NULL;
+
+ if ((ZSTR_LEN(key) + prefix->len) > YAC_STORAGE_MAX_KEY_LEN) {
+ php_error_docref(NULL, E_WARNING, "Key%s can not be longer than %d bytes",
diff --git a/PHPINFO b/PHPINFO
new file mode 100644
index 0000000..644138d
--- /dev/null
+++ b/PHPINFO
@@ -0,0 +1,15 @@
+
+yac
+
+yac support => enabled
+Version => 2.0.2
+Shared Memory => mmap
+Serializer => php
+
+Directive => Local Value => Master Value
+yac.enable => On => On
+yac.debug => Off => Off
+yac.keys_memory_size => 4M => 4M
+yac.values_memory_size => 64M => 64M
+yac.compress_threshold => -1 => -1
+yac.enable_cli => 0 => 0
diff --git a/REFLECTION b/REFLECTION
index 697e371..b25aebb 100644
--- a/REFLECTION
+++ b/REFLECTION
@@ -1,4 +1,4 @@
-Extension [ <persistent> extension #159 yac version 2.0.2 ] {
+Extension [ <persistent> extension #172 yac version 2.0.2 ] {
- INI {
Entry [ yac.enable <SYSTEM> ]
diff --git a/php-pecl-yac.spec b/php-pecl-yac.spec
index c252a64..594af57 100644
--- a/php-pecl-yac.spec
+++ b/php-pecl-yac.spec
@@ -3,7 +3,7 @@
#
# Fedora spec file for php-pecl-yac (previously php-yac)
#
-# Copyright (c) 2013-2017 Remi Collet
+# Copyright (c) 2013-2018 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
@@ -36,14 +36,16 @@ Version: 2.0.2
Release: 0.8.%{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: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz
%endif
License: PHP
-Group: Development/Languages
URL: http://pecl.php.net/package/%{pecl_name}
+Patch0: https://patch-diff.githubusercontent.com/raw/laruence/yac/pull/89.patch
+
+BuildRequires: %{?dtsprefix}gcc
BuildRequires: %{?scl_prefix}php-devel > 7
BuildRequires: %{?scl_prefix}php-pear
%if %{with_fastlz}
@@ -67,12 +69,6 @@ Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{rele
%if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel}
# Other third party repo stuff
-Obsoletes: php53-pecl-%{pecl_name} <= %{version}
-Obsoletes: php53u-pecl-%{pecl_name} <= %{version}
-Obsoletes: php54-pecl-%{pecl_name} <= %{version}
-Obsoletes: php54w-pecl-%{pecl_name} <= %{version}
-Obsoletes: php55u-pecl-%{pecl_name} <= %{version}
-Obsoletes: php55w-pecl-%{pecl_name} <= %{version}
Obsoletes: php56u-pecl-%{pecl_name} <= %{version}
Obsoletes: php56w-pecl-%{pecl_name} <= %{version}
Obsoletes: php70u-pecl-%{pecl_name} <= %{version}
@@ -122,6 +118,8 @@ sed -e 's/role="test"/role="src"/' \
-i package.xml
cd NTS
+%patch0 -p1 -b .pr89
+
%if %{with_fastlz}
sed -e '\:name="compressor/fastlz:d' -i ../package.xml
rm -r compressor/fastlz
@@ -156,6 +154,8 @@ cp -pr NTS ZTS
%build
+%{?dtsenable}
+
peclconf() {
%configure \
%if %{with_fastlz}
@@ -178,6 +178,8 @@ make %{?_smp_mflags}
%install
+%{?dtsenable}
+
# Install the NTS stuff
make -C NTS install INSTALL_ROOT=%{buildroot}
install -D -m 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name}
@@ -237,7 +239,7 @@ REPORT_EXIT_STATUS=1 \
%endif
-%if 0%{?fedora} < 24
+%if 0%{?fedora} < 24 && 0%{?rhel} < 8
# when pear installed alone, after us
%triggerin -- %{?scl_prefix}php-pear
if [ -x %{__pecl} ] ; then
@@ -272,6 +274,10 @@ fi
%changelog
+* Thu Jun 28 2018 Remi Collet <remi@remirepo.net> - 2.0.2-2
+- add patch for PHP 7.3 from
+ https://github.com/laruence/yac/pull/89
+
* Tue Aug 1 2017 Remi Collet <remi@remirepo.net> - 2.0.2-1
- Update to 2.0.2