summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2016-12-01 17:51:41 +0100
committerRemi Collet <fedora@famillecollet.com>2016-12-01 17:51:41 +0100
commit939fecbaf3f1bf6668c3ac09f1c9839a753b04b6 (patch)
tree301382b42b94a8816fc34914dc8f3ec4ee084377
parent45ec88aabf3ae76eb1cd377f71a118287eb76329 (diff)
php-pecl-yaconf: add patch for 7.1
-rw-r--r--php-pecl-yaconf.spec12
-rw-r--r--yaconf-upstream.patch99
2 files changed, 108 insertions, 3 deletions
diff --git a/php-pecl-yaconf.spec b/php-pecl-yaconf.spec
index 53a5b52..8b5092f 100644
--- a/php-pecl-yaconf.spec
+++ b/php-pecl-yaconf.spec
@@ -14,8 +14,7 @@
%global gh_project yaconf
#global gh_date 20150910
%global pecl_name yaconf
-# https://github.com/laruence/yaconf/issues/20
-%global with_zts 0
+%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}}
%global ini_name 40-%{pecl_name}.ini
Summary: Yet Another Configurations Container
@@ -25,13 +24,15 @@ Version: 1.0.3
Release: 0.8.%{gh_date}git%{gh_short}%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}-%{gh_short}.tar.gz
%else
-Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+Release: 3%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz
%endif
License: PHP
Group: Development/Languages
URL: https://github.com/%{gh_owner}/%{gh_project}
+Patch0: %{pecl_name}-upstream.patch
+
BuildRequires: %{?scl_prefix}php-devel > 7
BuildRequires: %{?scl_prefix}php-pear
@@ -94,6 +95,7 @@ mv %{pecl_name}-%{version} NTS
%{?_licensedir:sed -e '/LICENSE/s/role="doc"/role="src"/' -i package.xml}
cd NTS
+%patch0 -p1 -b .upstream
# Sanity check, really often broken
extver=$(sed -n '/#define PHP_YACONF_VERSION/{s/.* "//;s/".*$//;p}' php_yaconf.h)
@@ -235,6 +237,10 @@ fi
%changelog
+* Thu Dec 1 2016 Remi Collet <remi@fedoraproject.org> - 1.0.3-3
+- add upstream patch to fix segfaults
+- re-enable ZTS extension
+
* Thu Dec 1 2016 Remi Collet <remi@fedoraproject.org> - 1.0.3-2
- rebuild with PHP 7.1.0 GA
- disable ZTS extension which raise segfaults
diff --git a/yaconf-upstream.patch b/yaconf-upstream.patch
new file mode 100644
index 0000000..8545c84
--- /dev/null
+++ b/yaconf-upstream.patch
@@ -0,0 +1,99 @@
+From 950ed708b9da956025597c006a202ce1a0dc8b3f Mon Sep 17 00:00:00 2001
+From: Xinchen Hui <laruence@gmail.com>
+Date: Thu, 1 Dec 2016 18:13:33 +0800
+Subject: [PATCH] Fixed issue #20 (Segfault during test suite with 7.1.0GA
+ (TS))
+
+---
+ yaconf.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/yaconf.c b/yaconf.c
+index f98ab30..4606eff 100644
+--- a/yaconf.c
++++ b/yaconf.c
+@@ -527,7 +527,7 @@ PHP_MINIT_FUNCTION(yaconf)
+ ZVAL_UNDEF(&active_ini_file_section);
+ YACONF_G(parse_err) = 0;
+ php_yaconf_hash_init(&result, 128);
+- 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_yaconf_ini_parser_cb, (void *)&result) == FAILURE || YACONF_G(parse_err)) {
+ if (!YACONF_G(parse_err)) {
+ php_error(E_WARNING, "Parsing '%s' failed", ini_file);
+@@ -622,12 +622,12 @@ PHP_RINIT_FUNCTION(yaconf)
+ ZVAL_UNDEF(&active_ini_file_section);
+ YACONF_G(parse_err) = 0;
+ php_yaconf_hash_init(&result, 128);
+- 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_yaconf_ini_parser_cb, (void *)&result) == FAILURE || YACONF_G(parse_err)) {
+- YACONF_G(parse_err) = 0;
+ if (!YACONF_G(parse_err)) {
+ php_error(E_WARNING, "Parsing '%s' failed", ini_file);
+ }
++ YACONF_G(parse_err) = 0;
+ php_yaconf_hash_destroy(Z_ARRVAL(result));
+ free(namelist[i]);
+ continue;
+From 0ca4a280b6db9095f74f74fbd9edbae61017a22d Mon Sep 17 00:00:00 2001
+From: Xinchen Hui <laruence@gmail.com>
+Date: Thu, 1 Dec 2016 18:28:10 +0800
+Subject: [PATCH] Added test for issue #20
+
+---
+ tests/009.phpt | 11 +++++++++++
+ tests/inis/err/err/a.ini | 1 +
+ yaconf.c | 6 ------
+ 3 files changed, 12 insertions(+), 6 deletions(-)
+ create mode 100644 tests/009.phpt
+ create mode 100644 tests/inis/err/err/a.ini
+
+diff --git a/tests/009.phpt b/tests/009.phpt
+new file mode 100644
+index 0000000..e689f71
+--- /dev/null
++++ b/tests/009.phpt
+@@ -0,0 +1,11 @@
++--TEST--
++Check for INI errors
++--SKIPIF--
++<?php if (!extension_loaded("yaconf")) print "skip"; ?>
++--INI--
++yaconf.directory={PWD}/inis/err/err
++--FILE--
++<?php
++?>
++--EXPECTF--
++PHP: syntax error, unexpected ')' in %sa.ini on line 1
+diff --git a/tests/inis/err/err/a.ini b/tests/inis/err/err/a.ini
+new file mode 100644
+index 0000000..ffb9485
+--- /dev/null
++++ b/tests/inis/err/err/a.ini
+@@ -0,0 +1 @@
++skdjflksdjfkl.2)X(D)*_)(_
+diff --git a/yaconf.c b/yaconf.c
+index 4606eff..c7c2eff 100644
+--- a/yaconf.c
++++ b/yaconf.c
+@@ -529,9 +529,6 @@ PHP_MINIT_FUNCTION(yaconf)
+ php_yaconf_hash_init(&result, 128);
+ if (zend_parse_ini_file(&fh, 1, 0 /* ZEND_INI_SCANNER_NORMAL */,
+ php_yaconf_ini_parser_cb, (void *)&result) == FAILURE || YACONF_G(parse_err)) {
+- if (!YACONF_G(parse_err)) {
+- php_error(E_WARNING, "Parsing '%s' failed", ini_file);
+- }
+ YACONF_G(parse_err) = 0;
+ php_yaconf_hash_destroy(Z_ARRVAL(result));
+ free(namelist[i]);
+@@ -624,9 +621,6 @@ PHP_RINIT_FUNCTION(yaconf)
+ php_yaconf_hash_init(&result, 128);
+ if (zend_parse_ini_file(&fh, 1, 0 /* ZEND_INI_SCANNER_NORMAL */,
+ php_yaconf_ini_parser_cb, (void *)&result) == FAILURE || YACONF_G(parse_err)) {
+- if (!YACONF_G(parse_err)) {
+- php_error(E_WARNING, "Parsing '%s' failed", ini_file);
+- }
+ YACONF_G(parse_err) = 0;
+ php_yaconf_hash_destroy(Z_ARRVAL(result));
+ free(namelist[i]);