summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2016-06-09 08:25:59 +0200
committerRemi Collet <fedora@famillecollet.com>2016-06-09 08:25:59 +0200
commit977e0dbb085ab18063e19ffc0fd227da31dd1e3c (patch)
tree3779f9be06f6c43f676240a406725a1494b5ed06
parent5cc7e951f1c62d852d66aec89b28e680e3ca5ad3 (diff)
php-pecl-crypto: upstream patch for PHP 7.1
-rw-r--r--crypto-upstream.patch91
-rw-r--r--php-pecl-crypto.spec17
2 files changed, 105 insertions, 3 deletions
diff --git a/crypto-upstream.patch b/crypto-upstream.patch
new file mode 100644
index 0000000..b7b010b
--- /dev/null
+++ b/crypto-upstream.patch
@@ -0,0 +1,91 @@
+From ee493a2737fd29a8ff8c8e3dec7c6fa46822ef05 Mon Sep 17 00:00:00 2001
+From: Jakub Zelenka <bukka@php.net>
+Date: Wed, 6 Jan 2016 14:40:54 +0000
+Subject: [PATCH] Split name codes for Hash and MAC alg not found
+
+It prevents constant redefinition error
+---
+ crypto_hash.c | 8 ++++----
+ tests/CMAC___construct_basic.phpt | 2 +-
+ tests/HMAC___construct_basic.phpt | 2 +-
+ tests/Hash___construct_basic.phpt | 2 +-
+ 4 files changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/crypto_hash.c b/crypto_hash.c
+index 7fc0ded..2ce172a 100644
+--- a/crypto_hash.c
++++ b/crypto_hash.c
+@@ -29,7 +29,7 @@
+ PHP_CRYPTO_EXCEPTION_DEFINE(Hash)
+ PHP_CRYPTO_ERROR_INFO_BEGIN(Hash)
+ PHP_CRYPTO_ERROR_INFO_ENTRY(
+- ALGORITHM_NOT_FOUND,
++ HASH_ALGORITHM_NOT_FOUND,
+ "Hash algorithm '%s' not found"
+ )
+ PHP_CRYPTO_ERROR_INFO_ENTRY(
+@@ -134,7 +134,7 @@ static const zend_function_entry php_crypto_hash_object_methods[] = {
+ PHP_CRYPTO_EXCEPTION_DEFINE(MAC)
+ PHP_CRYPTO_ERROR_INFO_BEGIN(MAC)
+ PHP_CRYPTO_ERROR_INFO_ENTRY(
+- ALGORITHM_NOT_FOUND,
++ MAC_ALGORITHM_NOT_FOUND,
+ "MAC algorithm '%s' not found"
+ )
+ PHP_CRYPTO_ERROR_INFO_ENTRY(
+@@ -609,7 +609,7 @@ PHP_CRYPTO_METHOD(Hash, __construct)
+
+ digest = EVP_get_digestbyname(algorithm);
+ if (!digest) {
+- php_crypto_error_ex(PHP_CRYPTO_ERROR_ARGS(Hash, ALGORITHM_NOT_FOUND), algorithm);
++ php_crypto_error_ex(PHP_CRYPTO_ERROR_ARGS(Hash, HASH_ALGORITHM_NOT_FOUND), algorithm);
+ } else {
+ PHP_CRYPTO_HASH_ALG(PHPC_THIS) = digest;
+ }
+@@ -787,6 +787,6 @@ PHP_CRYPTO_METHOD(MAC, __construct)
+ return;
+
+ php_crypto_mac_alg_not_found:
+- php_crypto_error_ex(PHP_CRYPTO_ERROR_ARGS(MAC, ALGORITHM_NOT_FOUND), algorithm);
++ php_crypto_error_ex(PHP_CRYPTO_ERROR_ARGS(MAC, MAC_ALGORITHM_NOT_FOUND), algorithm);
+ efree(algorithm_uc);
+ }
+diff --git a/tests/CMAC___construct_basic.phpt b/tests/CMAC___construct_basic.phpt
+index abd58a3..77a66c6 100644
+--- a/tests/CMAC___construct_basic.phpt
++++ b/tests/CMAC___construct_basic.phpt
+@@ -28,7 +28,7 @@ try {
+ $cmac = new Crypto\CMAC($key, 'nnn');
+ }
+ catch (Crypto\MACException $e) {
+- if ($e->getCode() === Crypto\MACException::ALGORITHM_NOT_FOUND) {
++ if ($e->getCode() === Crypto\MACException::MAC_ALGORITHM_NOT_FOUND) {
+ echo "NOT FOUND\n";
+ }
+ }
+diff --git a/tests/HMAC___construct_basic.phpt b/tests/HMAC___construct_basic.phpt
+index 09a4d11..0200091 100644
+--- a/tests/HMAC___construct_basic.phpt
++++ b/tests/HMAC___construct_basic.phpt
+@@ -11,7 +11,7 @@ try {
+ $hmac = new Crypto\HMAC('key', 'nnn');
+ }
+ catch (Crypto\MACException $e) {
+- if ($e->getCode() === Crypto\MACException::ALGORITHM_NOT_FOUND) {
++ if ($e->getCode() === Crypto\MACException::MAC_ALGORITHM_NOT_FOUND) {
+ echo "NOT FOUND\n";
+ }
+ }
+diff --git a/tests/Hash___construct_basic.phpt b/tests/Hash___construct_basic.phpt
+index 0755703..ac8b0f5 100644
+--- a/tests/Hash___construct_basic.phpt
++++ b/tests/Hash___construct_basic.phpt
+@@ -11,7 +11,7 @@ try {
+ $hash = new Crypto\Hash('nnn');
+ }
+ catch (Crypto\HashException $e) {
+- if ($e->getCode() === Crypto\HashException::ALGORITHM_NOT_FOUND) {
++ if ($e->getCode() === Crypto\HashException::HASH_ALGORITHM_NOT_FOUND) {
+ echo "NOT FOUND\n";
+ }
+ }
diff --git a/php-pecl-crypto.spec b/php-pecl-crypto.spec
index 7113a0d..f87a24c 100644
--- a/php-pecl-crypto.spec
+++ b/php-pecl-crypto.spec
@@ -12,9 +12,9 @@
%else
%global sub_prefix %{scl_prefix}
%endif
+%scl_package php-pecl-crypto
%endif
-%{?scl: %scl_package php-pecl-crypto}
%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}}
%global pecl_name crypto
@@ -28,12 +28,14 @@
Summary: Wrapper for OpenSSL Crypto Library
Name: %{?sub_prefix}php-pecl-%{pecl_name}
Version: 0.2.2
-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;')}}
License: BSD
Group: Development/Languages
URL: http://pecl.php.net/package/%{pecl_name}
Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz
+Patch0: %{pecl_name}-upstream.patch
+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: %{?scl_prefix}php-devel > 5.3
BuildRequires: %{?scl_prefix}php-pear
@@ -51,9 +53,10 @@ Provides: %{?scl_prefix}php-%{pecl_name} = %{version}
Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version}
Provides: %{?scl_prefix}php-pecl(%{pecl_name}) = %{version}
Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version}
-# For morephp SCLs
+%if "%{?scl_prefix}" != "%{?sub_prefix}"
Provides: %{?scl_prefix}php-pecl-%{pecl_name} = %{version}-%{release}
Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release}
+%endif
%if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1}
# Other third party repo stuff
@@ -73,6 +76,10 @@ Obsoletes: php56w-pecl-%{pecl_name} <= %{version}
Obsoletes: php70u-pecl-%{pecl_name} <= %{version}
Obsoletes: php70w-pecl-%{pecl_name} <= %{version}
%endif
+%if "%{php_version}" > "7.1"
+Obsoletes: php71u-pecl-%{pecl_name} <= %{version}
+Obsoletes: php71w-pecl-%{pecl_name} <= %{version}
+%endif
%endif
%if 0%{?fedora} < 20 && 0%{?rhel} < 7
@@ -98,6 +105,7 @@ sed -e 's/role="test"/role="src"/' \
-i package.xml
cd NTS
+%patch0 -p1 -b .upstream
# Sanity check, really often broken
extver=$(sed -n '/#define PHP_CRYPTO_VERSION/{s/.* "//;s/".*$//;p}' php_crypto.h)
@@ -234,6 +242,9 @@ rm -rf %{buildroot}
%changelog
+* Thu Jun 9 2016 Remi Collet <remi@fedoraproject.org> - 0.2.2-3
+- add upstream patch for PHP 7.1
+
* Sat Mar 5 2016 Remi Collet <remi@fedoraproject.org> - 0.2.2-2
- adapt for F24