summaryrefslogtreecommitdiffstats
path: root/env-pr2.patch
diff options
context:
space:
mode:
Diffstat (limited to 'env-pr2.patch')
-rw-r--r--env-pr2.patch87
1 files changed, 87 insertions, 0 deletions
diff --git a/env-pr2.patch b/env-pr2.patch
new file mode 100644
index 0000000..fe754b7
--- /dev/null
+++ b/env-pr2.patch
@@ -0,0 +1,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
+ };
+ /* }}} */
+