diff options
author | Remi Collet <fedora@famillecollet.com> | 2016-01-01 20:02:55 +0100 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2016-01-01 20:02:55 +0100 |
commit | 4711391e366f20176b2d4c36b9e32f4548c18678 (patch) | |
tree | fcb886ceaee95b6db82bfa805eb683c59ec8a22d | |
parent | aa5725cda369f86d39d59d570eeef303ca30f193 (diff) |
php-pecl-env: 0.2.0 (beta)
-rw-r--r-- | REFLECTION | 2 | ||||
-rw-r--r-- | env-pr2.patch | 87 | ||||
-rw-r--r-- | php-pecl-env.spec | 23 |
3 files changed, 104 insertions, 8 deletions
@@ -1,4 +1,4 @@ -Extension [ <persistent> extension #90 env version 0.1.0 ] { +Extension [ <persistent> extension #90 env version 0.2.0 ] { - INI { Entry [ env.file <ALL> ] 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 + }; + /* }}} */ + diff --git a/php-pecl-env.spec b/php-pecl-env.spec index 09d0181..32aebde 100644 --- a/php-pecl-env.spec +++ b/php-pecl-env.spec @@ -29,7 +29,7 @@ Summary: Load environment variables Name: %{?sub_prefix}php-pecl-%{pecl_name} -Version: 0.1.0 +Version: 0.2.0 Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: MIT Group: Development/Languages @@ -37,6 +37,8 @@ URL: http://pecl.php.net/package/%{pecl_name} Source: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz +Patch0: %{pecl_name}-pr2.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) # ignore min PHP version 5.5 (as work with 5.4) BuildRequires: %{?scl_prefix}php-devel @@ -91,6 +93,8 @@ mv %{pecl_name}-%{version} NTS sed -e '/role="test"/d' -i package.xml cd NTS +%patch0 -p1 -b .pr2 + # Check upstream version (often broken) extver=$(sed -n '/#define PHP_ENV_VERSION/{s/.* "//;s/".*$//;p}' php_env.h) if test "x${extver}" != "x%{version}"; then @@ -156,29 +160,29 @@ done cd NTS : Minimal load test for NTS extension %{__php} --no-php-ini \ - --define extension=modules/%{pecl_name}.so \ + --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ --modules | grep %{pecl_name} : Upstream test suite for NTS extension TEST_PHP_EXECUTABLE=%{__php} \ -TEST_PHP_ARGS="-n -d extension=$PWD/modules/%{pecl_name}.so" \ +TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so" \ NO_INTERACTION=1 \ REPORT_EXIT_STATUS=1 \ -%{__php} -n run-tests.php +%{__php} -n run-tests.php --show-diff %if %{with_zts} cd ../ZTS : Minimal load test for ZTS extension %{__ztsphp} --no-php-ini \ - --define extension=modules/%{pecl_name}.so \ + --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ --modules | grep %{pecl_name} : Upstream test suite for ZTS extension TEST_PHP_EXECUTABLE=%{__ztsphp} \ -TEST_PHP_ARGS="-n -d extension=$PWD/modules/%{pecl_name}.so" \ +TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so" \ NO_INTERACTION=1 \ REPORT_EXIT_STATUS=1 \ -%{__ztsphp} -n run-tests.php +%{__ztsphp} -n run-tests.php --show-diff %endif @@ -221,5 +225,10 @@ fi %changelog +* Fri Jan 01 2016 Remi Collet <remi@fedoraproject.org> - 0.2.0-1 +- Update to 0.2.0 (beta) +- fix strange php 5.5 / i386 / ZTS + open https://github.com/beberlei/env/pull/2 + * Thu Dec 31 2015 Remi Collet <remi@fedoraproject.org> - 0.1.0-1 - initial RPM, version 0.1.0 (beta)
\ No newline at end of file |