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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
From 7352239d4e1eeab5483b48366401a40a8d2e8764 Mon Sep 17 00:00:00 2001
From: Remi Collet <fedora@famillecollet.com>
Date: Fri, 1 Jan 2016 19:44:43 +0100
Subject: [PATCH 1/2] fix strange race condition (php 5.5, ZTS, i386)
---
php5/php_env.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/php5/php_env.c b/php5/php_env.c
index b98a3c7..91d62a1 100644
--- a/php5/php_env.c
+++ b/php5/php_env.c
@@ -61,7 +61,13 @@ void php_env_request_init(HashTable *vars TSRMLS_DC)
type = zend_hash_get_current_key_ex(vars, &str, &len, &idx, 0, NULL);
if (type == HASH_KEY_IS_STRING) {
if ((zend_hash_get_current_data(vars, (void**)&data) == SUCCESS)) {
+ if (str[len]) { /* Workaroung php 5.5 / ZTS / i386 issue */
+ char *tmp = estrndup(str, len);
+ setenv(tmp, *data, 1);
+ efree(tmp);
+ } else {
setenv(str, *data, 1);
+ }
}
}
}
From 49372b5d4159c99d3fa15c78e1ffd6aa3c8def1c Mon Sep 17 00:00:00 2001
From: Remi Collet <fedora@famillecollet.com>
Date: Fri, 1 Jan 2016 19:45:08 +0100
Subject: [PATCH 2/2] use GINIT/GSHUTDOWN function
---
env.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/env.c b/env.c
index c4d0bf7..3178e10 100644
--- a/env.c
+++ b/env.c
@@ -50,18 +50,20 @@ void char_ptr_dtor(char **str)
#define char_ptr_dtor ZVAL_PTR_DTOR
#endif
-/* {{{ php_env_init_globals
+/* {{{ PHP_GINIT_FUNCTION
*/
-static void php_env_init_globals(zend_env_globals *env_globals)
+PHP_GINIT_FUNCTION(env)
{
env_globals->file = NULL;
env_globals->parse_err = 0;
env_globals->vars = (HashTable*)pemalloc(sizeof(HashTable), 1);
zend_hash_init(env_globals->vars, 128, NULL, char_ptr_dtor, 1);
}
-
/* }}} */
-static void php_env_shutdown_globals(zend_env_globals *env_globals)
+
+/* {{{ PHP_GSHUTDOWN_FUNCTION
+ */
+PHP_GSHUTDOWN_FUNCTION(env)
{
env_globals->file = NULL;
env_globals->parse_err = 0;
@@ -72,7 +74,6 @@ static void php_env_shutdown_globals(zend_env_globals *env_globals)
*/
PHP_MINIT_FUNCTION(env)
{
- ZEND_INIT_MODULE_GLOBALS(env, php_env_init_globals, php_env_shutdown_globals);
REGISTER_INI_ENTRIES();
php_env_module_init(ENV_G(vars) TSRMLS_CC);
@@ -144,7 +145,11 @@ zend_module_entry env_module_entry = {
PHP_RSHUTDOWN(env), /* Replace with NULL if there's nothing to do at request end */
PHP_MINFO(env),
PHP_ENV_VERSION,
- STANDARD_MODULE_PROPERTIES
+ PHP_MODULE_GLOBALS(env), /* globals descriptor */
+ PHP_GINIT(env), /* globals ctor */
+ PHP_GSHUTDOWN(env), /* globals dtor */
+ NULL, /* post deactivate */
+ STANDARD_MODULE_PROPERTIES_EX
};
/* }}} */
|