summaryrefslogtreecommitdiffstats
path: root/env-pr10.patch
diff options
context:
space:
mode:
Diffstat (limited to 'env-pr10.patch')
-rw-r--r--env-pr10.patch149
1 files changed, 148 insertions, 1 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);
+ }