summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2024-10-01 08:18:38 +0200
committerRemi Collet <remi@php.net>2024-10-01 08:18:38 +0200
commitea8663682975738b00e003dd7ce818c6ceaf7894 (patch)
treef964382a1e9cc4cdbe47545971e62f5905027acd
parent5a3c25b4098f6a41c20f7f69ee6834dce1cec607 (diff)
fix [-Wincompatible-pointer-types] since 8.1 using patch fromHEADmaster
from https://github.com/beberlei/env/pull/10
-rw-r--r--env-pr10.patch149
-rw-r--r--env-pr8.patch73
-rw-r--r--php-pecl-env.spec63
3 files changed, 163 insertions, 122 deletions
diff --git a/env-pr10.patch b/env-pr10.patch
index b4a754c..055937c 100644
--- a/env-pr10.patch
+++ b/env-pr10.patch
@@ -1,7 +1,7 @@
From cf3d85f354489a39c96823332c797af45a4e781f Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Tue, 22 Sep 2020 15:01:31 +0200
-Subject: [PATCH] trivial fix for PHP 8
+Subject: [PATCH 1/4] trivial fix for PHP 8
---
env.h | 6 ++++++
@@ -23,3 +23,150 @@ index 85059ef..b0a67be 100644
void php_env_module_init(HashTable *vars TSRMLS_DC);
void php_env_request_init(HashTable *vars TSRMLS_DC);
#endif
+
+From cc660bfe4d0f5bb315e776892ceee500637e5262 Mon Sep 17 00:00:00 2001
+From: Remi Collet <fedora@famillecollet.com>
+Date: Thu, 1 Dec 2016 17:40:42 +0100
+Subject: [PATCH 2/4] fix segfault with 7.1.0, fix #7
+
+---
+ php7/php_env.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/php7/php_env.c b/php7/php_env.c
+index 22c19b4..b891ba7 100644
+--- a/php7/php_env.c
++++ b/php7/php_env.c
+@@ -37,7 +37,7 @@ void php_env_module_init(HashTable *vars TSRMLS_DC) {
+ fh.filename = ENV_G(file);
+ fh.type = ZEND_HANDLE_FP;
+
+- if (zend_parse_ini_file(&fh, 0, 0 /* ZEND_INI_SCANNER_NORMAL */,
++ if (zend_parse_ini_file(&fh, 1, 0 /* ZEND_INI_SCANNER_NORMAL */,
+ php_env_ini_parser_cb, vars) == FAILURE || ENV_G(parse_err)) {
+ if (ENV_G(parse_err)) {
+ php_error(E_WARNING, "env: parsing '%s' failed", ENV_G(file));
+
+From b03a18682a939e241e756a5bb86c41bde8ec99f1 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Wed, 19 Feb 2020 09:38:24 +0100
+Subject: [PATCH 3/4] fix multiple definition of 'env_globals'
+
+---
+ php5/php_env.c | 2 --
+ php7/php_env.c | 2 --
+ php_env.h | 2 ++
+ 3 files changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/php5/php_env.c b/php5/php_env.c
+index 62a231a..a1381df 100644
+--- a/php5/php_env.c
++++ b/php5/php_env.c
+@@ -2,8 +2,6 @@
+ #include "../php_env.h"
+ #include "../env.h"
+
+-ZEND_DECLARE_MODULE_GLOBALS(env)
+-
+ static void php_env_ini_parser_cb(zval *key, zval *value, zval *index, int callback_type, HashTable *ht) /* {{{ */ {
+ zval *rv;
+ char *str;
+diff --git a/php7/php_env.c b/php7/php_env.c
+index b891ba7..b1fa628 100644
+--- a/php7/php_env.c
++++ b/php7/php_env.c
+@@ -2,8 +2,6 @@
+ #include "../php_env.h"
+ #include "../env.h"
+
+-ZEND_DECLARE_MODULE_GLOBALS(env)
+-
+ static void php_env_ini_parser_cb(zval *key, zval *value, zval *index, int callback_type, void *arg) /* {{{ */ {
+ HashTable *ht = (HashTable*)arg;
+ char *str;
+diff --git a/php_env.h b/php_env.h
+index de91d42..8455854 100644
+--- a/php_env.h
++++ b/php_env.h
+@@ -44,6 +44,8 @@ ZEND_BEGIN_MODULE_GLOBALS(env)
+ int parse_err;
+ ZEND_END_MODULE_GLOBALS(env)
+
++ZEND_EXTERN_MODULE_GLOBALS(env)
++
+ #ifdef ZTS
+ #define ENV_G(v) TSRMG(env_globals_id, zend_env_globals *, v)
+ #else
+
+From f66fbcf635f7f258c32ab9d103ac44906093989d Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Tue, 1 Oct 2024 08:05:46 +0200
+Subject: [PATCH 4/4] fix for 8.1
+
+---
+ env.c | 3 ---
+ php7/php_env.c | 12 ++++++++----
+ 2 files changed, 8 insertions(+), 7 deletions(-)
+
+diff --git a/env.c b/env.c
+index 9263445..6ef73d7 100644
+--- a/env.c
++++ b/env.c
+@@ -30,9 +30,6 @@
+
+ ZEND_DECLARE_MODULE_GLOBALS(env)
+
+-/* True global resources - no need for thread safety here */
+-static int le_env;
+-
+ /* {{{ PHP_INI
+ */
+ PHP_INI_BEGIN()
+diff --git a/php7/php_env.c b/php7/php_env.c
+index b1fa628..c9956f7 100644
+--- a/php7/php_env.c
++++ b/php7/php_env.c
+@@ -23,16 +23,17 @@ static void php_env_ini_parser_cb(zval *key, zval *value, zval *index, int callb
+ }
+
+ void php_env_module_init(HashTable *vars TSRMLS_DC) {
+- int ndir = 255;
+- uint32_t i;
+- unsigned char c;
+ struct zend_stat sb;
+ zend_file_handle fh = {0};
+
+ if (ENV_G(file) != NULL && strlen(ENV_G(file)) > 0 && VCWD_STAT(ENV_G(file), &sb) == 0) {
+ if (S_ISREG(sb.st_mode)) {
+ if ((fh.handle.fp = VCWD_FOPEN(ENV_G(file), "r"))) {
++#if PHP_VERSION_ID >= 80100
++ fh.filename = zend_string_init(ENV_G(file), strlen(ENV_G(file)), 0);
++#else
+ fh.filename = ENV_G(file);
++#endif
+ fh.type = ZEND_HANDLE_FP;
+
+ if (zend_parse_ini_file(&fh, 1, 0 /* ZEND_INI_SCANNER_NORMAL */,
+@@ -43,6 +44,9 @@ void php_env_module_init(HashTable *vars TSRMLS_DC) {
+
+ ENV_G(parse_err) = 0;
+ }
++#if PHP_VERSION_ID >= 80100
++ zend_string_release(fh.filename);
++#endif
+ }
+ }
+ }
+@@ -51,11 +55,11 @@ void php_env_module_init(HashTable *vars TSRMLS_DC) {
+ void php_env_request_init(HashTable *vars TSRMLS_DC)
+ {
+ zend_string *str;
+- uint len;
+ ulong idx;
+ zval *val;
+
+ ZEND_HASH_FOREACH_KEY_VAL(vars, idx, str, val) {
++ (void)idx;
+ if (str) {
+ setenv(ZSTR_VAL(str), Z_PTR_P(val), 1);
+ }
diff --git a/env-pr8.patch b/env-pr8.patch
deleted file mode 100644
index 6ace4d9..0000000
--- a/env-pr8.patch
+++ /dev/null
@@ -1,73 +0,0 @@
-From 58552b8035d4b0a72040f0c8aed91ae849172eda Mon Sep 17 00:00:00 2001
-From: Remi Collet <fedora@famillecollet.com>
-Date: Thu, 1 Dec 2016 17:40:42 +0100
-Subject: [PATCH 1/2] fix segfault with 7.1.0, fix #7
-
----
- php7/php_env.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/php7/php_env.c b/php7/php_env.c
-index 22c19b4..b891ba7 100644
---- a/php7/php_env.c
-+++ b/php7/php_env.c
-@@ -37,7 +37,7 @@ void php_env_module_init(HashTable *vars TSRMLS_DC) {
- fh.filename = ENV_G(file);
- fh.type = ZEND_HANDLE_FP;
-
-- if (zend_parse_ini_file(&fh, 0, 0 /* ZEND_INI_SCANNER_NORMAL */,
-+ if (zend_parse_ini_file(&fh, 1, 0 /* ZEND_INI_SCANNER_NORMAL */,
- php_env_ini_parser_cb, vars) == FAILURE || ENV_G(parse_err)) {
- if (ENV_G(parse_err)) {
- php_error(E_WARNING, "env: parsing '%s' failed", ENV_G(file));
-
-From b91c4c1302b6fc8c731072d8d0b4e3eb7275f534 Mon Sep 17 00:00:00 2001
-From: Remi Collet <remi@remirepo.net>
-Date: Wed, 19 Feb 2020 09:38:24 +0100
-Subject: [PATCH 2/2] fix multiple definition of 'env_globals'
-
----
- php5/php_env.c | 2 --
- php7/php_env.c | 2 --
- php_env.h | 2 ++
- 3 files changed, 2 insertions(+), 4 deletions(-)
-
-diff --git a/php5/php_env.c b/php5/php_env.c
-index 62a231a..a1381df 100644
---- a/php5/php_env.c
-+++ b/php5/php_env.c
-@@ -2,8 +2,6 @@
- #include "../php_env.h"
- #include "../env.h"
-
--ZEND_DECLARE_MODULE_GLOBALS(env)
--
- static void php_env_ini_parser_cb(zval *key, zval *value, zval *index, int callback_type, HashTable *ht) /* {{{ */ {
- zval *rv;
- char *str;
-diff --git a/php7/php_env.c b/php7/php_env.c
-index b891ba7..b1fa628 100644
---- a/php7/php_env.c
-+++ b/php7/php_env.c
-@@ -2,8 +2,6 @@
- #include "../php_env.h"
- #include "../env.h"
-
--ZEND_DECLARE_MODULE_GLOBALS(env)
--
- static void php_env_ini_parser_cb(zval *key, zval *value, zval *index, int callback_type, void *arg) /* {{{ */ {
- HashTable *ht = (HashTable*)arg;
- char *str;
-diff --git a/php_env.h b/php_env.h
-index de91d42..8455854 100644
---- a/php_env.h
-+++ b/php_env.h
-@@ -44,6 +44,8 @@ ZEND_BEGIN_MODULE_GLOBALS(env)
- int parse_err;
- ZEND_END_MODULE_GLOBALS(env)
-
-+ZEND_EXTERN_MODULE_GLOBALS(env)
-+
- #ifdef ZTS
- #define ENV_G(v) TSRMG(env_globals_id, zend_env_globals *, v)
- #else
diff --git a/php-pecl-env.spec b/php-pecl-env.spec
index cda9714..6fc42e2 100644
--- a/php-pecl-env.spec
+++ b/php-pecl-env.spec
@@ -11,30 +11,24 @@
%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}}
%global pecl_name env
-%if "%{php_version}" < "5.6"
-%global ini_name %{pecl_name}.ini
-%else
%global ini_name 40-%{pecl_name}.ini
-%endif
%global sources %{pecl_name}-%{version}
%global _configure ../%{sources}/configure
Summary: Load environment variables
Name: %{?scl_prefix}php-pecl-%{pecl_name}
Version: 0.2.1
-Release: 12%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+Release: 13%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
License: MIT
URL: https://pecl.php.net/package/%{pecl_name}
Source: https://pecl.php.net/get/%{sources}.tgz
Patch0: %{pecl_name}-pr4.patch
-Patch1: %{pecl_name}-pr8.patch
Patch2: %{pecl_name}-pr10.patch
BuildRequires: make
BuildRequires: %{?dtsprefix}gcc
-# ignore min PHP version 5.5 (as work with 5.4)
BuildRequires: %{?scl_prefix}php-devel
BuildRequires: %{?scl_prefix}php-pear
@@ -46,20 +40,6 @@ 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}
-%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel}
-# Other third party repo stuff
-%if "%{php_version}" > "7.3"
-Obsoletes: php73-pecl-%{pecl_name} <= %{version}
-%endif
-%if "%{php_version}" > "7.4"
-Obsoletes: php74-pecl-%{pecl_name} <= %{version}
-%endif
-%if "%{php_version}" > "8.0"
-Obsoletes: php80-pecl-%{pecl_name} <= %{version}
-%endif
-%endif
-
-
%description
Based on 12Factor Application rules this extension allows
you to load environment variables into every PHP request,
@@ -74,12 +54,11 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO
# Remove test file to avoid regsitration
sed -e 's/role="test"/role="src"/' \
- %{?_licensedir:-e '/LICENSE/s/role="doc"/role="src"/' } \
+ -e '/LICENSE/s/role="doc"/role="src"/' \
-i package.xml
cd %{sources}
%patch -P0 -p1 -b .pr4
-%patch -P1 -p1 -b .pr8
%patch -P2 -p1 -b .pr10
# Check upstream version (often broken)
@@ -106,13 +85,16 @@ mkdir NTS ZTS
cd %{sources}
%{__phpize}
+[ -f Makefile.global ] && GLOBAL=Makefile.global || GLOBAL=build/Makefile.global
+sed -e 's/INSTALL_ROOT/DESTDIR/' -i $GLOBAL
cd ../NTS
%configure \
--enable-env \
--with-libdir=%{_lib} \
--with-php-config=%{__phpconfig}
-make %{?_smp_mflags}
+
+%make_build
%if %{with_zts}
cd ../ZTS
@@ -120,14 +102,15 @@ cd ../ZTS
--enable-env \
--with-libdir=%{_lib} \
--with-php-config=%{__ztsphpconfig}
-make %{?_smp_mflags}
+
+%make_build
%endif
%install
%{?dtsenable}
-make -C NTS install INSTALL_ROOT=%{buildroot}
+%make_install -C NTS
# Install XML package description
install -Dpm 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml
@@ -136,7 +119,7 @@ install -Dpm 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml
install -Dpm644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name}
%if %{with_zts}
-make -C ZTS install INSTALL_ROOT=%{buildroot}
+%make_install -C ZTS
install -Dpm644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name}
%endif
@@ -176,28 +159,8 @@ REPORT_EXIT_STATUS=1 \
%endif
-%if 0%{?fedora} < 24 && 0%{?rhel} < 8
-# when pear installed alone, after us
-%triggerin -- %{?scl_prefix}php-pear
-if [ -x %{__pecl} ] ; then
- %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || :
-fi
-
-# posttrans as pear can be installed after us
-%posttrans
-if [ -x %{__pecl} ] ; then
- %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || :
-fi
-
-%postun
-if [ $1 -eq 0 -a -x %{__pecl} ] ; then
- %{pecl_uninstall} %{pecl_name} >/dev/null || :
-fi
-%endif
-
-
%files
-%{?_licensedir:%license %{sources}/LICENSE}
+%license %{sources}/LICENSE
%doc %{pecl_docdir}/%{pecl_name}
%{pecl_xmldir}/%{name}.xml
@@ -211,6 +174,10 @@ fi
%changelog
+* Tue Oct 1 2024 Remi Collet <remi@remirepo.net> - 0.2.1-13
+- fix [-Wincompatible-pointer-types] since 8.1 using patch from
+ from https://github.com/beberlei/env/pull/10
+
* Fri Sep 1 2023 Remi Collet <remi@remirepo.net> - 0.2.1-12
- build out of sources tree