summaryrefslogtreecommitdiffstats
path: root/env-pr8.patch
blob: 6ace4d9dd7fb5e7045612797cc818804d3f3d73c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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